Skip to main content
gamedev.net
🔒 Locked

Visual C++ Express Debugging

Started by Cadoink 5 replies 1.4k views
Original Post
Cadoink
Cadoink
Hey. I decided I wanted to get back into C++ Programming. I have Visual C++ Express Edition 2008. I had a few programs that worked very well. Now when I try to debug and run my programs they don't work. I haven't done anything to the code since they worked perfectly. I can get them to work a little. For example I have a program that can convert feet to inches etc. When I try the measurement it needs to convert the program just quits without giving me my answer. It has never done this before. I also see this at the Output thing at the bottom of Visual C++ 'Super Calculator.exe': Loaded 'C:\Users\Chris\Documents\Visual Studio 2008\Projects\Hello World\Debug\Super Calculator.exe', Symbols loaded. 'Super Calculator.exe': Loaded 'C:\Windows\System32\ntdll.dll' 'Super Calculator.exe': Loaded 'C:\Windows\System32\kernel32.dll' 'Super Calculator.exe': Loaded 'C:\Windows\winsxs\x86_microsoft.vc90.debugcrt_1fc8b3b9a1e18e3b_9.0.21022.8_none_96748342450f6aa2\msvcr90d.dll' 'Super Calculator.exe': Loaded 'C:\Windows\winsxs\x86_microsoft.vc90.debugcrt_1fc8b3b9a1e18e3b_9.0.21022.8_none_96748342450f6aa2\msvcp90d.dll' The program '[5400] Super Calculator.exe: Native' has exited with code 0 (0x0).
Cromulent
Cromulent
When it says your program has exited with code 0. It means that your program ran succesfully but exited before you could see anything. Add a bit that takes user input so that you have to press return before it will exit so that you can actually see the result.
Cadoink
Cadoink
I wondered this. But you see before it would always give the results and just stay there without quitting.

Since I haven't touched the code there must be something going on.

I have this vague memory that there are 2 ways to debug and compile, and one keeps the program going.

Any thoughts?
Sneftel
Sneftel
If you start the program in the IDE via the "Start without debugging" command, it'll pause before exiting.
Cadoink
Cadoink
Ok. I see. I use to press ctrl - F5 to compile.

is there any piece of code that can be typed to do end a program.

For example if end is type the program will end.
bubu LV
bubu LV
You mean stopping debugging of program? Keyboard shortcut for this is Shift+F5. Or from menu: Debugging -> Stop Debugging.
mmakrzem
mmakrzem
Quote:
Original post by Cadoink
Ok. I see. I use to press ctrl - F5 to compile.

is there any piece of code that can be typed to do end a program.

For example if end is type the program will end.


You could use cin to get input from the user but this seems a little excessive. If you use Ctrl+F5 you'll keep the output window open. If you want to debug the program, add some break points into your code and run it with the debugger. When you hit a breakpoint the program will pause allowing you to see the output window and all the variables in memory.

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.