Trouble forcing an include with "-include"

Marc Glisse marc.glisse@inria.fr
Wed Sep 16 09:16:00 GMT 2015


On Wed, 16 Sep 2015, Jeffrey Walton wrote:

> I'm trying to test for some C++ features via preprocessor macros. Some
> macros (like __GXX_VERSION__) are only triggered by including a C++
> standard library file. According to Issue 67195, "cpp and g++ does not
> define __GLIBCXX__", I should only need to include c++config.h.
>
> The following is failing to pickup GCC's standard C++ configuration file:
>
>    g++ -include c++config.h -dM -E - < /dev/.null | sort

Don't use this - < /dev/null, it only works halfway. Create a true empty 
file empty.cc instead.

> The command (and variations like "-include c\+\+config.h" and
> "-include bits/c++config.h") produces:

bits/c++config.h is the right one.

> I guess a related question is, why is G++ using cc1, and not cc1plus?

Add -x c++ (gcc guesses based on the file name). Yes, it would make sense 
for c++ to be the default with g++...

-- 
Marc Glisse



More information about the Gcc-help mailing list