problems with writting a simple program

i m a new user to C++.   i have created a really simple program

 

#include <iostream>
using namespace std;

int main ()
{
 cout <<"hello world!"<< endl;
 return 0 ;
}

 

 

but when i try to build it there is an error and i got these lines off a text book i wonder why there is an error

 

------ Build started: Project: first program, Configuration: Debug Win32 ------

Compiling...
first program.cpp
d:\Documents and Settings\Bill Tang\Desktop\first program\first program.cpp(10) : fatal error C1010: unexpected end of file while looking for precompiled header directive

Build log was saved at "file://d:\Documents and Settings\Bill Tang\Desktop\first program\Debug\BuildLog.htm"
first program - 1 error(s), 0 warning(s)


---------------------- Done ----------------------

    Build: 0 succeeded, 1 failed, 0 skipped

 




Answer this question

problems with writting a simple program

  • Todd Wenzel

    Hi, I am a returning newbie, I have recently installed MS Studio 6, an dwhen using Visual C++ I too am having the same problem.

    I tried to look up the instructions you gave, can I ask where they for version 6 or a newer version

    Cheers,

    Dave


  • WM8S

    HI

     

    First, you have to make sure you biuld the right kind of project. (You a console application)

    The problem you see here is the Precompiled header files:

    there are two solutions to that, wether you switch the use of those files of (Project->Properties - Configuration Properties -> c/c++ -> Precompiled headers : switch to not using....)or you simply include the file (put in  #include "stahx.h" as first line in the file ).

     

     


  • Cypris

    honestly I don't remember exactly whereit is in version 6, it's a while ago i worked with it.

    I suggest you get visual studio 2005 version, the express version are for free at the moment and are able to do much more than a newbie will ever need.

    Also the include version is quite easy.

    The settings should be somewhere in the porperties of the project. Just have a look around I'm sure you'll find it, it's there somewhere ;). I mean it's goog to know anyway what is where in this menues, so get to know it.

    Flo


  • problems with writting a simple program