I'm a bit confused on how the precompiled header system works. I'm using Visual Studio 2005 and when trying to include multiple .cpp files in a project, they each, on compile, give me an unexpected end of file error. I have them all set to precompile a header, stdafx.h, and I'm not really sure how to get rid of that error.

Without those two .cpp files my program runs fine (with only my main .cpp file), but after including those (and adding the #include "stdafx.h" line to the top of each file) they both give me unexpected end of file errors. I'm sure this is pretty common, and an easy fix. Just wondering about how I can fix it, thanks!

Recommended Answers

All 2 Replies

Goto project settings and turn off precompiled headers would be my suggestion.

For a feature which is supposed to improve productivity, it sure provokes an awful lot of questions from all sections of the community.

Yeah, I tried turning off precompiled headers but its still giving me problems. I've recently tried using Dev-C++ and it's much easier to work in than VC++.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.