Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Issue with precompiled header directive 1

Status
Not open for further replies.

Jooky68

Programmer
Jul 10, 2002
231
US
I am trying to compile a .cpp file but I am getting the following error:

(1782): fatal error C1010: unexpected end of file while looking for precompiled header directive

Any ideas why I would be getting this error message? My head file is included and resides in the same directory.
 
If it's VS wizard generated project, you (probably) have StdAfx.h and StdAfx.cpp files (and use precompiled headers flag on by default). Insert
Code:
#include "StdAfx.h"
in all your .cpp files then (or before) add all system headers in StdAfx.h then compile StdAfx.cpp explicitly (and recomile after StdAfx.h changing).

It's not C++ as a language issue. It's VC++ (at least up to v. 6.0) pre-compiled header feature peculiarities...

May be it helps...
 
You can also turn off precompiled headers (they aren't all that helpful for small projects). Look in the Project settings in VC++ 6.0, and in the Project Properties for later versions to find the Use Precompiled Headers option and turn it off.

If you don't want the precompiled headers on when you create your project, make sure to select Empty Project in the wizard.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top