My cpp file includes C header that has a enumerator with comma at the end. As a result g++ produces warning:
warning: comma at end of enumerator list
How can I tell g++ to use -std=c99 for that cpp file? That is, how can I avoid this warning?
I already tried: -std=c99 but it resulted in: “cc1plus: warning: command line option “-std=c99″ is valid for C/ObjC but not for C++”
Note: the inclusion of C headers is surrounded with extern “C” command.
You don’t.
g++compiles C++, not C. A C header included in a C++ source file still has to follow C++ rules, even withextern "C". For example, the header cannot useclassas an identifier.