Author Topic: Precompiled headers and -iquote  (Read 6536 times)

Offline Trigve

  • Multiple posting newcomer
  • *
  • Posts: 15
Precompiled headers and -iquote
« on: October 23, 2009, 04:43:31 pm »
Hi,
I've problem using precompiled headers with CB nightly (10. october - 5859 svn). In stdafx.cpp file I've got only one line
Code
#include "stdafx.h"
stdafx.h is header that should be precompiled. When I build precompiled header and then compile stdafx.cpp, the precompiled header isn't use. I've tried it with inserting dummy stdafx.h with #error and put it to object output dir and compile the stdafx.cpp WITHOUT stdafx.h.gch and no error is raised. So evidently the object output dir isn't searched for includes. However -iquote is used. Anyway if I use
Code
#include <stdafx.h>
precompiled headers are taken into care (of course as the local dir is searched after the "-I" dirs). Here is command line when building stdafx.cpp:
Code
mingw32-g++.exe  -g -W -O0 -DWIN32 -D_DEBUG -D_WINDOWS -D_USRDLL -DUTILS_EXPORTS -DLIBXML_STATIC  -Winit-self -Wcast-align -Wundef -Winline -Wmissing-declarations -Wmissing-include-dirs -Wmain   -iquoteDebug\src -IDebug\src -I. -ID:\work\Other\Xml\libxml2-2.7.3\include -ID:\work\Other\Utils\boost_1_40_0  -c D:\work\xxx\xxx\branches\gcc\xxx\src\stdafx.cpp -o Debug\src\stdafx.o

In project properties I've checked "Generate PCH in the object output dir" option. I'm using mingw 4.4.1-tdm-2

Thanks

Trigve

Offline stahta01

  • Lives here!
  • ****
  • Posts: 7093
    • My Best Post
Re: Precompiled headers and -iquote
« Reply #1 on: October 23, 2009, 05:22:13 pm »
Suggest you look at how the Code::Blocks project does precompiles in the src target.

MinGW GCC is used and it is NOT done the way you are trying.

Look at the properties of the sdk.h file it is marked to be compiled.

Tim S.
C Programmer working to learn more about C++ and Git.
On Windows 7 64 bit and Windows 10 32 bit.
On Debian Stretch, compiling CB Trunk against wxWidgets 3.0.
--
When in doubt, read the CB WiKi FAQ. http://wiki.codeblocks.org

Offline Trigve

  • Multiple posting newcomer
  • *
  • Posts: 15
Re: Precompiled headers and -iquote
« Reply #2 on: October 23, 2009, 05:47:37 pm »
Thanks for reply,
Suggest you look at how the Code::Blocks project does precompiles in the src target.

MinGW GCC is used and it is NOT done the way you are trying.

What do you mean by that? I've looked at CB project files and haven't found anything special there.

Look at the properties of the sdk.h file it is marked to be compiled.

I have the "same" properties set on my header file that should be precompiled. Maybe if you could be more precise about what need to be adjusted it'll be great.

Thanks

Trigve


Offline stahta01

  • Lives here!
  • ****
  • Posts: 7093
    • My Best Post
Re: Precompiled headers and -iquote
« Reply #3 on: October 23, 2009, 07:06:48 pm »

In project properties I've checked "Generate PCH in the object output dir" option. I'm using mingw 4.4.1-tdm-2

Thanks

Trigve

Sorry about my prior post I thought stdafx.h.gch was not being created.

Have you tried the other two "Generate PCH" options one of them was broken when gcc 4.x came out; but, I thought that was fixed in the nightly a year or so ago.

Tim S.

C Programmer working to learn more about C++ and Git.
On Windows 7 64 bit and Windows 10 32 bit.
On Debian Stretch, compiling CB Trunk against wxWidgets 3.0.
--
When in doubt, read the CB WiKi FAQ. http://wiki.codeblocks.org

Offline Trigve

  • Multiple posting newcomer
  • *
  • Posts: 15
Re: Precompiled headers and -iquote
« Reply #4 on: October 23, 2009, 08:34:28 pm »
Sorry about my prior post I thought stdafx.h.gch was not being created.

Have you tried the other two "Generate PCH" options one of them was broken when gcc 4.x came out; but, I thought that was fixed in the nightly a year or so ago.

Tim S.

With default option ("Generate PCH alongside original header") everything is working right. It looks like it's mingw bug.

Trigve

Offline MortenMacFly

  • Administrator
  • Lives here!
  • *****
  • Posts: 9613
Re: Precompiled headers and -iquote
« Reply #5 on: October 23, 2009, 10:28:22 pm »
With default option ("Generate PCH alongside original header") everything is working right. It looks like it's mingw bug.
I don't know what version you are using, but in a recent nightly this has been adjusted to work with more recent GCC's, too.
Compiler logging: Settings->Compiler & Debugger->tab "Other"->Compiler logging="Full command line"
C::B Manual: http://www.codeblocks.org/docs/main_codeblocks_en.html
C::B FAQ: http://wiki.codeblocks.org/index.php?title=FAQ

Offline Trigve

  • Multiple posting newcomer
  • *
  • Posts: 15
Re: Precompiled headers and -iquote
« Reply #6 on: October 23, 2009, 11:02:27 pm »
I don't know what version you are using, but in a recent nightly this has been adjusted to work with more recent GCC's, too.

I'm using nightly from 10. October. And there it is not working apparently (or I'm doing something wrong).

Trigve

Offline stahta01

  • Lives here!
  • ****
  • Posts: 7093
    • My Best Post
Re: Precompiled headers and -iquote
« Reply #7 on: October 24, 2009, 01:18:18 am »
I don't know what version you are using, but in a recent nightly this has been adjusted to work with more recent GCC's, too.

I'm using nightly from 10. October. And there it is not working apparently (or I'm doing something wrong).

Trigve

An related fix to stop an warning caused by GCC 4.x required an exe file to be the exact name it was expecting I think it wanted gcc.exe

If you do not have an file called what it wanted copy one to it; it used it to get the version of gcc.

Tim S.


 
C Programmer working to learn more about C++ and Git.
On Windows 7 64 bit and Windows 10 32 bit.
On Debian Stretch, compiling CB Trunk against wxWidgets 3.0.
--
When in doubt, read the CB WiKi FAQ. http://wiki.codeblocks.org

Offline Trigve

  • Multiple posting newcomer
  • *
  • Posts: 15
Re: Precompiled headers and -iquote
« Reply #8 on: October 24, 2009, 06:09:09 pm »
Ok I've "fixed" it with moving header that need to be precompiled to separate dir.

Trigve