Hi there guys, I've recently purchased "Sam's Teach Yourself C++ Fifth Edition" (About a week before the 6th edition came out)
I'm trying to work through the book, but in trying to compile Hello World, I keep getting an error instead of it making the program.
I've looked around the internet for a reason, but come up stuck.
My only assumption would be that the fifth edition is upgraded to suit newer compilers? (I downloaded Visual C++ 2008 Express Edition from Microsoft.
I am in a Win32 console project, and enter the code as follows:
#include <iostream>
int main()
{
std::cout << "Hello World!\n";
return 0;
}
But when I try and compile, I get the following:
1>------ Build started: Project: HelloWorld, Configuration: Debug Win32 ------
1>Compiling...
1>HelloWorld.cp p
1>c:\documents and settings\adams\ my documents\visua l studio 2008\projects\h elloworld\hello world\helloworl d.cpp(1) : warning C4627: '#include <iostream>': skipped when looking for precompiled header use
1> Add directive to 'stdafx.h' or rebuild precompiled header
1>c:\documents and settings\adams\ my documents\visua l studio 2008\projects\h elloworld\hello world\helloworl d.cpp(8) : fatal error C1010: unexpected end of file while looking for precompiled header. Did you forget to add '#include "stdafx.h"' to your source?
1>Build log was saved at "file://c:\Documents and Settings\Adams\ My Documents\Visua l Studio 2008\Projects\H elloWorld\Hello World\Debug\Bui ldLog.htm"
1>HelloWorld - 1 error(s), 1 warning(s)
Sorry about the question, just wonderinfg if it's something I'm doing wrong, or if I need a new book, or to change something throughout the book?
I'm trying to work through the book, but in trying to compile Hello World, I keep getting an error instead of it making the program.
I've looked around the internet for a reason, but come up stuck.
My only assumption would be that the fifth edition is upgraded to suit newer compilers? (I downloaded Visual C++ 2008 Express Edition from Microsoft.
I am in a Win32 console project, and enter the code as follows:
#include <iostream>
int main()
{
std::cout << "Hello World!\n";
return 0;
}
But when I try and compile, I get the following:
1>------ Build started: Project: HelloWorld, Configuration: Debug Win32 ------
1>Compiling...
1>HelloWorld.cp p
1>c:\documents and settings\adams\ my documents\visua l studio 2008\projects\h elloworld\hello world\helloworl d.cpp(1) : warning C4627: '#include <iostream>': skipped when looking for precompiled header use
1> Add directive to 'stdafx.h' or rebuild precompiled header
1>c:\documents and settings\adams\ my documents\visua l studio 2008\projects\h elloworld\hello world\helloworl d.cpp(8) : fatal error C1010: unexpected end of file while looking for precompiled header. Did you forget to add '#include "stdafx.h"' to your source?
1>Build log was saved at "file://c:\Documents and Settings\Adams\ My Documents\Visua l Studio 2008\Projects\H elloWorld\Hello World\Debug\Bui ldLog.htm"
1>HelloWorld - 1 error(s), 1 warning(s)
Sorry about the question, just wonderinfg if it's something I'm doing wrong, or if I need a new book, or to change something throughout the book?
Comment