2
votes

So, I have to use precompiled headers in my VS 2005 project. Now I have a shared source file that does not have a #include "stdafx.h"... How can I include the shared source file in my project without adding stdafx.h to the top of the source file and without turning off precompiled headers??

3

3 Answers

7
votes

File properties -> C/C++ -> Precompiled Headers -> Create/Use precompiled headers -> Not using ...

1
votes

Look in the properties (context menu) for that file, in the C/C++ - Precompiled Header section.

Change "Create/Use Precompiled Header" to "Not Using Precompiled Headers".

Note - I just checked this in VC++2003 - the option might have moved in VC++2005 or 2008, but I doubt it. Even if it has moved, though, it shouldn't be hard to find.

1
votes

You could also use the 'Force Include' option: "This option has the same effect as specifying the file with double quotation marks in an #include directive on the first line of every source file specified on the command line, in the CL environment variable, or in a command file."

Very handy to introduce PreCompiled Headers without changing all the source files...