http://gcc.gnu.org/bugzilla/show_bug.cgi?id=57242
Richard Biener <rguenth at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|UNCONFIRMED |WAITING Last reconfirmed| |2013-05-13 Ever confirmed|0 |1 --- Comment #5 from Richard Biener <rguenth at gcc dot gnu.org> --- (In reply to etherice from comment #4) > (In reply to Andrew Pinski from comment #1) > > This is by design as -g changes the information produced by the front-end > > and maybe even predefines too. > > I created a simpler test to demonstrate the bug. Two files: > > ---------- > pch.hpp > ---------- > #ifndef __PCH_HPP__ > #define __PCH_HPP__ > #pragma message "[ not using pre-compiled headers ]" > #include <iostream> > #endif > > ---------- > test.cpp > ---------- > #include <pch.hpp> > int main() { > std::cout << "hello world" << std::endl; > return 0; > } > > ---------- > > If you run commands [1] and [2] below, you will notice that pch is ignored. > > [1] g++ -I. pch.hpp -o pch.hpp.gch > [2] g++ -I. -c test.cpp -o test.o > [3] g++ -I. -c test.cpp -o test.o -include pch.hpp How? I see rguenther@murzim:/tmp> g++-4.7 -I. pch.hpp -o pch.hpp.gch pch.hpp:3:19: note: #pragma message: [ not using pre-compiled headers ] rguenther@murzim:/tmp> g++-4.7 -I. -c test.cpp -o test.o rguenther@murzim:/tmp> g++-4.7 -I. -c test.cpp -o test.o -include pch.hpp rguenther@murzim:/tmp> g++-4.8 -I. pch.hpp -o pch.hpp.gch pch.hpp:3:19: note: #pragma message: [ not using pre-compiled headers ] #pragma message "[ not using pre-compiled headers ]" ^ rguenther@murzim:/tmp> g++-4.8 -I. -c test.cpp -o test.o rguenther@murzim:/tmp> g++-4.8 -I. -c test.cpp -o test.o -include pch.hpp the issue is probably that there are pre-installed precompiled headers for libstdc++ which use certain flags. Maybe in your case this confuses things? (disclaimer: I always install gcc built with --disable-libstdcxx-pch) Try removing them.