I have a problem when g ++ starts in C ++ 11 mode, some proprocessor macros are not expanded correctly. This causes me problems compiling programs using Qt.
$ g++ --version g++ (GCC) 4.7.2 Copyright (C) 2012 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
The following snapshot reveals the problem:
$ cat foo.cpp //
Pre-execution without C ++ 11 does the right thing.
$ g++ -E foo.cpp # 1 "foo.cpp" # 1 "<command-line>" # 1 "foo.cpp" # 15 "foo.cpp" qFlagLocation("0""grml" "\0""foo.cpp"":""15")
But in C ++ 11 mode, the QTOSTRING macro does not expand, causing a compilation error in the source line.
$ g++ -std=c++11 -E foo.cpp # 1 "foo.cpp" # 1 "<command-line>" # 1 "foo.cpp" # 15 "foo.cpp" qFlagLocation("0""grml" "\0"__FILE__":"QTOSTRING(15))
Is this behavior intended and what can I do to enable the extension?
source share