Whole Tomato Software Forums
Whole Tomato Software Forums
Main Site | Profile | Register | Active Topics | Members | Search | FAQ
User name:
Password:
Save Password
Forgot your password?

 All Forums
 Visual Assist
 Feature Requests
 Precompiled header in #include list
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

saberhawk
New Member

6 Posts

Posted - Nov 11 2009 :  6:31:23 PM  Show Profile  Reply with Quote
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  Show Profile  Reply with Quote
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
Go to Top of Page

saberhawk
New Member

6 Posts

Posted - Nov 12 2009 :  6:16:10 PM  Show Profile  Reply with Quote
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
Go to Top of Page

feline
Whole Tomato Software

United Kingdom
18950 Posts

Posted - Nov 30 2009 :  11:56:38 AM  Show Profile  Reply with Quote
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
Go to Top of Page

saberhawk
New Member

6 Posts

Posted - Nov 30 2009 :  3:34:38 PM  Show Profile  Reply with Quote
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"
Go to Top of Page

feline
Whole Tomato Software

United Kingdom
18950 Posts

Posted - Dec 03 2009 :  1:49:58 PM  Show Profile  Reply with Quote
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
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
© 2023 Whole Tomato Software, LLC Go To Top Of Page
Snitz Forums 2000