Author Topic: precompiled headers: don't understan compiler warning  (Read 4594 times)

Offline frithjofh

  • Regular
  • ***
  • Posts: 376
precompiled headers: don't understan compiler warning
« 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
architect with some spare time  -  c::b compiled from last svn  -   openSuSE leap x86_64  -  AMD FX-4100

Offline thomas

  • Administrator
  • Lives here!
  • *****
  • Posts: 3979
Re: precompiled headers: don't understan compiler warning
« Reply #1 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).
"We should forget about small efficiencies, say about 97% of the time: Premature quotation is the root of public humiliation."

Offline mandrav

  • Project Leader
  • Administrator
  • Lives here!
  • *****
  • Posts: 4315
    • Code::Blocks IDE
Re: precompiled headers: don't understan compiler warning
« Reply #2 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.
Be patient!
This bug will be fixed soon...