Author Topic: Debug_wx_pch_h_gch: not used because `__NO_INLINE__' not defined [-Winvalid-pch]  (Read 8413 times)

Offline eranon

  • Almost regular
  • **
  • Posts: 180
Hello. I'm getting this warning during release building :

Quote
cc1plus.exe: warning: ./wx_pch.h.gch/Debug_wx_pch_h_gch: not used because `__NO_INLINE__' not defined [-Winvalid-pch]
So, I suppose compiler complains about use of debug version of precompiled file for a release build... But why ? Where to change this through C::B, please ?
[Independent dev. - wxWidgets 3.0.0 under "Win 7 Pro 64-bit, C::B SVN 9435 & wxSmith, TDM64-GCC 4.7 & MSVC9" + "OS X 10.8, FSF GCC 4.7 & C::B SVN 8909"]

Offline MortenMacFly

  • Administrator
  • Lives here!
  • *****
  • Posts: 9694
Where to change this through C::B, please ?
Choose to put the PCH headers into the object's output folder in the project settings and select a different object output folder for the release/debug target (which you have to do anyways, btw...).
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

Offline eranon

  • Almost regular
  • **
  • Posts: 180
OK, solved, Morten : thanks (it will become an habit). I've deleted previous dir containing the wx_pch.h.gch's and changed the "precompiled stategy" in project settings as you said... So, now, zero warning  : cool ;)
[Independent dev. - wxWidgets 3.0.0 under "Win 7 Pro 64-bit, C::B SVN 9435 & wxSmith, TDM64-GCC 4.7 & MSVC9" + "OS X 10.8, FSF GCC 4.7 & C::B SVN 8909"]

Offline tigerbeard

  • Almost regular
  • **
  • Posts: 190
Quote
cc1plus.exe: warning: ./wx_pch.h.gch/Debug_wx_pch_h_gch: not used because `__NO_INLINE__' not defined [-Winvalid-pch]

I know its an old post, but thats what I found googling the issue. As the root cause is so stupid I do not want to spent much time on it again when I am going to run into it next time.

Root Cause:
There is nothing CB can do about it, its a GCC problem.
The warning happens when -Winvalid-pch is configured to warn about PCH issues. Since all PCHs could be in the same folder, GCC puts the BuildTarget name into them to keep them apart, e.g. "xxxReleasexxxx" or "xxxDebugxxxx". Compiling "Debug" will be fine. But when you compile "Release" gcc looks into the folder for 'gch'' files and first finds the "Debug" version. Since this is not the correct one it prints the warning. Only then it looks for the next file and finds the correct "Release" version. So it continues to compile with no further warnings. The code will run fine.
The result is a flood useless warnings for any Release build, but none for the Debug build. Maybe there is an architectural reason why they can not look for other fiiles first and then throw the warning, but so we get yet another confusing gcc warning.

There are two wys to sove this
1. Put the PCH files into separate folders. Only the middle C::B option will do that
2. The alternative is to not use -Winvalid-pch compiler switch