'<command-line>:0:3: warning: ISO C++11 requires whitespace after the macro name

I am compiling qt sources (C++) on different version of Ubuntu OS (14.04 and 16.04 LTS). The sources compile (g++) on 14.04 LTS without warnings. But on 16.04 gives following warnings "<command-line>:0:3: warning: ISO C++11 requires whitespace after the macro name warnings".

I am wondering what causes this error? Thanks in advance.

g++ --version: 5.4.0 20160609.



Solution 1:[1]

You probably have a g++ command line with an invalid -D option. (Or perhaps more than one of those.)

The second two warnings can be triggered by

g++ '-DFOO"unterminated' ...

(Note the missing = after FOO.)

Since you're probably using some build system, the likely cause is an incorrect build configuration which gives rise to an unterminated quote in the -D argument. (Although it is also not unlikely that the quote itself was unintentional.)

Solution 2:[2]

This error is also caused by invalid characters in your define name. I had the same error trying to do this:

g++ -Dsomedefine++=1

Solution 3:[3]

In my case the error was because of commas present in macro VALUE...

-DPRED='WSum<4,Pixel>'

escaping the comma solved the problem

-DPRED='WSum<4\,Pixel>'

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1
Solution 2 foddex
Solution 3 6502