Sign in to follow this  
Cadoink

Visual C++ Express Debugging

Recommended Posts

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).

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
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?

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this