Author |
Topic |
|
saberhawk
New Member
6 Posts |
Posted - Nov 11 2009 : 6:31:23 PM
|
Visual Studio allows you to configure a project to use a virtual filename to access the precompiled header, however Visual Assist doesn't list this virtual file in the #include dropdown list and it would be nice if it did. |
|
feline
Whole Tomato Software
United Kingdom
18950 Posts |
Posted - Nov 12 2009 : 1:59:10 PM
|
I am not familiar with this option. Which IDE are you using, and how do you configure this? |
zen is the art of being at one with the two'ness |
|
|
saberhawk
New Member
6 Posts |
Posted - Nov 12 2009 : 6:16:10 PM
|
Visual Studio 2008 You setup precompiled headers like you normally would (with a header like stdafx.h and stdafx.cpp). The options set on stdafx.cpp for creating the header remain the same. In the project properties you can change the "Create/Use PCH Through File" to something like "precompiled_header" and now all the files can include "precompiled_header" and VC will use the one compiled via stdafx.cpp |
|
|
feline
Whole Tomato Software
United Kingdom
18950 Posts |
Posted - Nov 30 2009 : 11:56:38 AM
|
Apologies for the delay in getting back to you about this, I have been busy working on VS2010 Beta 2. I have just run some experiments with this, using VS2008, and a new default C++ console project.
After changing this project setting I have tried to use this new #include statement, and the project does not compile.
This default project only contains 2 .cpp files, "stdafx.cpp" and my main file "cpp_console_include_test.cpp"
If I leave "stdafx.cpp" alone, so it contains the line:
#include "stdafx.h"
I get the error:
error C2857: '#include' statement specified with the /Ycprecompiled_header.h command-line option was not found in the source file
and if I change stdafx.cpp to use:
#include "precompiled_header.h"
where this is what I have set the project setting to, I get the error message:
fatal error C1083: Cannot open include file: 'precompiled_header.h': No such file or directory c:\\src-2008\\cpp_console_include_test\\cpp_console_include_test\\stdafx.cpp
it seems the compiler cannot find this "virtual" file. Am I missing something basic here? I have never used this project setting before. |
zen is the art of being at one with the two'ness |
|
|
saberhawk
New Member
6 Posts |
Posted - Nov 30 2009 : 3:34:38 PM
|
Modify the settings on stdafx.cpp only to change the "Create/Use PCH via file" to "stdafx.h" and include "stdafx.h" in "stdafx.cpp"; the global project settings should still say "precompiled_header.h" |
|
|
feline
Whole Tomato Software
United Kingdom
18950 Posts |
Posted - Dec 03 2009 : 1:49:58 PM
|
That fixed it, thank you. I am now seeing the problem in a project that compiles:
case=36417
For now, adding an empty file with the name of your precompiled file works. The file is listed in the #include listbox, but the compiler does not include it. I have checked this by adding such a file and adding invalid code to it, and the solution still compiles correctly. |
zen is the art of being at one with the two'ness |
|
|
|
Topic |
|