News:

As usual while waiting for the next release - don't forget to check the nightly builds in the forum.

Main Menu

About PCH settings

Started by lfm, June 01, 2006, 07:23:11 AM

Previous topic - Next topic

lfm

I tested a simple application, settings in "project->properties->Project->Precompiled headers", when i select "Generate PCH in a directory alongside original header" (this is default), it will be compiled succesfully; But when i select "Generate PCH in the object output dir (default)", it will be compiled with a error: "no such file or directory".
Please see the follows project file:


[attachment deleted by admin]

MortenMacFly

...did you realise that it is working if you add "in1" to the compiler directories for this project?
With regards, Morten.
Compiler logging: Settings->Compiler & Debugger->tab "Other"->Compiler logging="Full command line"
C::B Manual: [url="https://www.codeblocks.org/docs/main_codeblocks_en.html"]https://www.codeblocks.org/docs/main_codeblocks_en.html[/url]
C::B FAQ: [url="https://wiki.codeblocks.org/index.php?title=FAQ"]https://wiki.codeblocks.org/index.php?title=FAQ[/url]

lfm

Quote from: MortenMacFly on June 01, 2006, 09:13:23 AM
...did you realise that it is working if you add "in1" to the compiler directories for this project?
With regards, Morten.
Of course, copiled successfuly if add "in1".
I modified the project file, please download and test again.

MortenMacFly

For the new project you'll have to add the ..\include\in1 folder, too.
I'm not sure I get what you think the issue shall be. The compiler does exactly what you want. In the second case the compiler command line (without adding ..\include\in1) is:

mingw32-g++.exe  -I- -I. -I..\include -ID:\Devel\GCC345\include  -c main.cpp -o .objs\main.o

Using the "generat PCH in the object output dir" enables the "-I-" compiler switch. If you read what's said about the "-I-" switch it makes perfect sense that the compiler complains about "../in0.h: No such file or directory":

-I- Split the include path.  Any directories specified with -I options before -I-
      are searched only for headers requested with "#include "file""; they are not
      searched for "#include <file>".  If additional directories are specified with -I
      options after the -I-, those directories are searched for all #include directives.
      In addition, -I- inhibits the use of the directory of the current file directory as
      the first search directory for "#include "file"".

This means that you have to explicetly add all header include folders after the "-I-" switch (in the compiler options of your project). If you do that it'll compile just fine.
With regards, Morten.
Compiler logging: Settings->Compiler & Debugger->tab "Other"->Compiler logging="Full command line"
C::B Manual: [url="https://www.codeblocks.org/docs/main_codeblocks_en.html"]https://www.codeblocks.org/docs/main_codeblocks_en.html[/url]
C::B FAQ: [url="https://wiki.codeblocks.org/index.php?title=FAQ"]https://wiki.codeblocks.org/index.php?title=FAQ[/url]

lfm

Quote from: MortenMacFly on June 01, 2006, 09:56:32 AM
This means that you have to explicetly add all header include folders after the "-I-" switch (in the compiler options of your project). If you do that it'll compile just fine.
With regards, Morten.
Thank you !