Hi All,
I am VERY new to C++ so please bear with my ignorance/stupidity.
I have a Teach yourself C++ book and the first chapter asks me to create the hello world program.
I have installed Visual studio 2010 and I have started the below:
This is word for word what the book asks me to do.
However when I try to build this i get the below errors
------ Build started: Project: Hello, Configuration: Debug Win32 ------
Hello.cpp
c:\users\tim-laptop\documents\visual studio 2010\projects\hello\hello\hello.cpp(1): warning C4627: '#include <iostream>': skipped when looking for precompiled header use
Add directive to 'StdAfx.h' or rebuild precompiled header
c:\users\tim-laptop\documents\visual studio 2010\projects\hello\hello\hello.cpp(9): 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 tried adding the StdAfx.h to the same file and no go.
If anyone can tell me what i did wrong in this probably simple thing i would be great
#include "stdafx.h" //above everything it is only need for microsoft visual c++
#include <iostream>
int main()
{
std::cout << "Hello World!" << std::endl;// endl stands for endLine not end1
system("pause");// if you do not add this it immediately closes the program and you see nothing of output
return 0;
}
the green text in the code above are comments and are ignored by the compiler.