Problems with visual C++

Hi i'm trying to learn C++ using a book called C++ primer. I decided to use visual C++ as the IDE which worked out fine to start off with and then some weird things started happening. When I first started using this just to create a Hello World application the program colour coded everything and indented when indentation was needed. This has now gone away and I would like to know how to get it back?

Another thing which has started to happen is some really random errors about debugging. I am trying to create a 'for application that adds all the numbers from 1 to 10.

Code Snippet

#include <iostream>
int main()
{
int sum = 0;
for (int val = 1; val <= 10; ++val)
sum += val;

std::cout << "Sum of 1 to 10 inclusive is: "
<< sum << std::endl;
return 0;
}


and the errors i get:
Code Snippet

'Exercise1.9.exe': Loaded 'C:\Documents and Settings\ASH!\My Documents\Visual Studio 2005\Projects\Exercise1.9\debug\Exercise1.9.exe', Binary was not built with debug information.
'Exercise1.9.exe': Loaded 'C:\WINDOWS\system32\ntdll.dll', No symbols loaded.
'Exercise1.9.exe': Loaded 'C:\WINDOWS\system32\kernel32.dll', No symbols loaded.
The program '[3996] Exercise1.9.exe: Native' has exited with code 0 (0x0).


What I am trying to do is create a single program for practice wit C++ so would it be best doing:
CLR empty project
CLR console application
Win32 console application

Any help with these 3 problems is greatly appreciated

Thanks
Ash

[1945 byte] By [Ash1402] at [2008-1-7]
# 1
It's not error
first line is that program is build but without debug information and debugger can work not correctly.
next two lines is that program is load but symbols from ntdll.dll and kernel32.dll wasn't loaded because it's not needful
In line fourth your program exit normal (without errors - code 0).

Running
If you want to run console program you must add:
system("pause");
at the end of your code (but before last } ) and run, your program will be run and stand for press any key. Another method is run program on system console (cmd.exe). You can also debug program and preview varabiables in it.

Debugging
If you want to debug your program you should build it with "Debug" (you can set it in "solution configuration" at the top bar). And next you must set breakpoints in line of code where you want that program stop and you can see variables. You can also set condition when your breakpoint will be break a program (Right-click on breakpoint and you can see options).
You can put breakpoint at return 0; and you can switch to your program console and see your program result

I wish you success in learn programming

Micha?Zalewski at 2007-10-2 > top of Msdn Tech,Visual Studio Express Editions,Visual C++ 2005 Express Edition...