Author Topic: About PCH settings  (Read 5580 times)

lfm

  • Guest
About PCH settings
« on: June 01, 2006, 07:23:11 am »
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]
« Last Edit: June 01, 2006, 09:42:05 am by lfm »

Offline MortenMacFly

  • Administrator
  • Lives here!
  • *****
  • Posts: 9694
Re: About PCH settings
« Reply #1 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.
Compiler logging: Settings->Compiler & Debugger->tab "Other"->Compiler logging="Full command line"
C::B Manual: https://www.codeblocks.org/docs/main_codeblocks_en.html
C::B FAQ: https://wiki.codeblocks.org/index.php?title=FAQ

lfm

  • Guest
Re: About PCH settings
« Reply #2 on: June 01, 2006, 09:40:42 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.

Offline MortenMacFly

  • Administrator
  • Lives here!
  • *****
  • Posts: 9694
Re: About PCH settings
« Reply #3 on: June 01, 2006, 09:56:32 am »
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:
Code
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":
Code
 -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: https://www.codeblocks.org/docs/main_codeblocks_en.html
C::B FAQ: https://wiki.codeblocks.org/index.php?title=FAQ

lfm

  • Guest
Re: About PCH settings
« Reply #4 on: June 01, 2006, 10:26:59 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 !