program won't run in VC++ Express

This is a discussion on program won't run in VC++ Express within the C++ Programming forums, part of the General Programming Boards category; Hi everyone..
This code was from a book and I was trying to compile it with VC++ Express.
Code:
#include ...

It looks like it runs fine to me - I'm a little bit suprised that it exits after the "system("PAUSE")", but it looks like it runs fine - you didn't build the debug version, and you don't have a symbol server set up [nor should you need one - but that is why you get some "No Symbols loaded" - but unless you actually intend to debug kernel32.dll or ntdll.dll, you don't need those symbols].

Try building your code as debug instead, and then set a breakpoint on the beginning of main (put the cursor at "int celsius;" and hit F9 on the keyboard). Run it in the debugger and see if you get there.

> int main (int nNumberofArgs, char * pszArgs[]);
The ; at the end of this line means you didn't compile this code.
Also, calling the arguments anything other than argc and argv is more confusing, especially when you attempt to replace them with Hungarian notation equivalents.

> 'temp.exe': Loaded 'C:\WINDOWS\system32\kernel32.dll', No symbols loaded.
This just means that should you want to dig really deep into the library code your program calls, you'll find it hard without the symbols. It doesn't affect how your code runs, nor the ability to debug your code.

> The program '[1556] temp.exe: Native' has exited with code 0 (0x0).
Exit with code 0 is good, it means your program ran successfully.

Try building your code as debug instead, and then set a breakpoint on the beginning of main (put the cursor at "int celsius;" and hit F9 on the keyboard). Run it in the debugger and see if you get there.
Mats

How do I build it as debug and how will I run it in the debugger? Sorry.. please bear with me.

As to building for debug [1], If you right-click on your project pane (the bold name of your project) and select the "Properties", you will get a dialog box <project> Property Pages. One of the fields is a "Configuration manager", which gives another dialog. This box has a "Active Solution Configuration" selection box - select "Debug".

Once you have a debug build, just press F5 to run - or select Debug->Run in the main menu.

[1] This is not based on a VC++ 2005 but VC++ .Net, but from what little I tried it, I think it was the same when I used the 2005 version.

>> How do I build it as debug and how will I run it in the debugger?
It should be built in debug mode by default (you can check by going to Build > Configuration Manager and verifying that the solution configuration is Debug).

You are already running it through the debugger, the output you posted is what happens when you run the program through the debugger. You either hit F5 or selected Debug > Start Debugging or clicked the triangular play button on the toolbar.

What might be happening is that generating debug info got turned off. Go to Project > Properties. Select Configuration Properties > C/C++ > General and make sure that the Debug Information Format is set to Progam Database (/Zi) or Progam Database for Edit & Continue (/ZI). Then Rebuild Solution to make sure it gets generated.

>> Post your current program attempt.
This means post your current code like you did at the start of this thread.

Here's the current program. I really didn't change anything except for the semicolon after the int main line. You guys were right, the debug setting was disabled. I changed it to program database format (/Zi) but the output is still the same, just a blank screen.

P.S. Youd need to learn to read the compiler errors.(23) Is the line you should be looking at (general area)'endln' specific peace of code compiler had problem withundeclared identifier Compiler hasn't heard of it, (doesn't know about it).