https://gcc.gnu.org/bugzilla/show_bug.cgi?id=70722
--- Comment #11 from Nadav Har'El <nyh at math dot technion.ac.il> --- By the way, I think I made a mistake in my comment and -D_GLIBCXX_INCLUDE_NEXT_C_HEADERS is not actually needed. The thing is that header files like <cmath> have: #define _GLIBCXX_INCLUDE_NEXT_C_HEADERS #include_next <math.h> #undef _GLIBCXX_INCLUDE_NEXT_C_HEADERS And this forces me to put the modified math.h after, not before as expected, the C++ headers in the include path. It is actually fine for me that if someone includes <math.h> he gets the libstdc++ one - which then includes (in C++) <cmath> which eventually includes (as above) my modified C header, so I do not actually need to set _GLIBCXX_INCLUDE_NEXT_C_HEADERS. Just set the header file order in the "right" (according to libstdc++) order, which unfortunately requires me to figure out the system's default C++ header directory (not /usr/include!) and add it explicitly to the include path.