Code::Blocks Forums

User forums => Using Code::Blocks => Topic started by: frithjofh on November 14, 2007, 10:01:58 pm

Title: precompiled headers: don't understan compiler warning
Post by: frithjofh on November 14, 2007, 10:01:58 pm
hi,

whenever I change the build-target I get these warnings for every file compiled (I only put one as example):

Compiling: cteApp.cpp
cc1plus.exe: warning: ./wx_pch.h.gch/Debug_wx_pch_h_gch: created using different flags

Why is he warning? I'm compiling release-target and in the folder ./wx_pch.h.gch there is a file  "Release_wx_pch_h_gch" newly generated. So what does he ( the gcc ) want to tell me ... ????   :?

I'm using C::B 4596 on windows XP pro

Greetings

frithjofh
Title: Re: precompiled headers: don't understan compiler warning
Post by: thomas on November 15, 2007, 09:04:31 am
What it says is that the precompiled header that you're using has been created with different compiler flags than the ones the compiler is currently using. The file Release_wx_pch_h_gch that you refer to is obviously not the one being used.

Please note that calling something Release_ does not create any magical bonds to a build target that is incidentially called "Release". You really have to use the other file too. One way to achieve this is to use a proxy header that contains an #ifdef and define a constant in the target accordingly, another option is to simply rebuild precompiled headers for debug and release targets (this is harmless most of the time, as you don't usually build the two together).
Title: Re: precompiled headers: don't understan compiler warning
Post by: mandrav on November 15, 2007, 09:18:06 am
Quote
Why is he warning? I'm compiling release-target and in the folder ./wx_pch.h.gch there is a file  "Release_wx_pch_h_gch" newly generated. So what does he ( the gcc ) want to tell me ... ????

In your case, this is a possibly harmless warning which is emitted because of the -Wivnalid-pch option in your project's build options.
When PCH is used as a directory, each build target creating that PCH creates it in the one and same directory, using the target name as a prefix (in your case I 'd bet Debug_*_gch and Release_*_gch). It's up to gcc to pick the correct PCH up and use it. The warning just tells you that it ignores the *other* PCH, the one it doesn't use.