News:

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

Main Menu

Precompiled headers and -iquote

Started by Trigve, October 23, 2009, 04:43:31 PM

Previous topic - Next topic

Trigve

Hi,
I've problem using precompiled headers with CB nightly (10. october - 5859 svn). In stdafx.cpp file I've got only one line
#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
#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:
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

stahta01

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++.
On Windows 10 64 bit and Windows 11 64 bit.
--
When in doubt, read the CB WiKi FAQ. [url="http://wiki.codeblocks.org"]http://wiki.codeblocks.org[/url]

Trigve

Thanks for reply,
Quote from: stahta01 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.

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

Quote from: stahta01 on October 23, 2009, 05:22:13 PM
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


stahta01

Quote from: Trigve on October 23, 2009, 04:43:31 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++.
On Windows 10 64 bit and Windows 11 64 bit.
--
When in doubt, read the CB WiKi FAQ. [url="http://wiki.codeblocks.org"]http://wiki.codeblocks.org[/url]

Trigve

Quote from: stahta01 on October 23, 2009, 07:06:48 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

MortenMacFly

Quote from: Trigve on October 23, 2009, 08:34:28 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: [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]

Trigve

Quote from: MortenMacFly on October 23, 2009, 10:28:22 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

stahta01

Quote from: Trigve on October 23, 2009, 11:02:27 PM
Quote from: MortenMacFly on October 23, 2009, 10:28:22 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

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++.
On Windows 10 64 bit and Windows 11 64 bit.
--
When in doubt, read the CB WiKi FAQ. [url="http://wiki.codeblocks.org"]http://wiki.codeblocks.org[/url]

Trigve

Ok I've "fixed" it with moving header that need to be precompiled to separate dir.

Trigve