Hey guys,
I recently got the book "Visual C++ 6 In Record Time" by Steven Holzner in hopes to learn C++
I downloaded Visual C++ 2010 for use with the book
The first thing is asked me to do is enter the following:
1 2 3 4 5 6
#include <iostream.h>
void main()
{
cout << "Welcome to C++ \n";
}
but when I try to build "first.exe" I receive the following:
1>------ Build started: Project: first, Configuration: Debug Win32 ------
1> first.cpp
1>c:\vcpp\first\first\first\first.cpp(4): warning C4627: '#include <iostream.h>': skipped when looking for precompiled header use
1> Add directive to 'StdAfx.h' or rebuild precompiled header
1>c:\vcpp\first\first\first\first.cpp(10): fatal error C1010: unexpected end of file while looking for precompiled header. Did you forget to add '#include "StdAfx.h"' to your source?
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
Is the information in the book im reading outdated?, is it worth reading to help learn C++, because if i keep getting errors like this it will just confuse me about it more.
Hi Catfish2 i tried the code you gave me and received the following
1>------ Build started: Project: first, Configuration: Debug Win32 ------
1> first.cpp
1>c:\vcpp\first\first\first\first.cpp(6): warning C4627: '#include <iostream>': skipped when looking for precompiled header use
1> Add directive to 'StdAfx.h' or rebuild precompiled header
1>c:\vcpp\first\first\first\first.cpp(17): fatal error C1010: unexpected end of file while looking for precompiled header. Did you forget to add '#include "StdAfx.h"' to your source?
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
I have done this and it now builds successfully!
but my problem now is it won't run.
it says it can't find the .exe
any ideas?
EDIT: i've figured this part out now i was adding a .cpp externally rather than part of my original project, but now my next problem
'hello.exe': Loaded 'C:\Users\Neil\Documents\Visual Studio 2010\Projects\hello\Debug\hello.exe', Symbols loaded.
'hello.exe': Loaded 'C:\Windows\System32\ntdll.dll', Cannot find or open the PDB file
'hello.exe': Loaded 'C:\Windows\System32\kernel32.dll', Cannot find or open the PDB file
'hello.exe': Loaded 'C:\Windows\System32\KernelBase.dll', Cannot find or open the PDB file
'hello.exe': Loaded 'C:\Windows\System32\msvcp100d.dll', Symbols loaded.
'hello.exe': Loaded 'C:\Windows\System32\msvcr100d.dll', Symbols loaded.
The program '[3108] hello.exe: Native' has exited with code 0 (0x0).