mismatched c++ header versions

c++, c++11, linux, ubuntu

Solution

Fixed.

The problem was in the build command:

g++-4.8 -m64 -std=c++0x -c -g -I/usr/include/jsoncpp/json -std=c++0x -MMD -MP -MF build/Debug/GNU-Linux-x86/_ext/803384703/CharNode.o.d -o build/Debug/GNU-Linux-x86/_ext/803384703/CharNode.o ../doublets/CharNode.cpp

The `-I` command includes directories to search when locating header files. Both `os_defines.h` and my own files include reference to different header files with the same name: `features.h`. I think there's a standard one and there's one in the jsoncpp library that I was using.

The problem was that the `-I` command above went one directory too far and should not have had the `/json` on the end. The standard libraries refer to this file as `features.h`, and internally jsoncpp does the same for its own `features.h` file.

Had I looked down the thousands of generated errors I would have seen that my own references to the jsoncpp libraries header files were resulting in a "header file not found" error, but I didn't get this far.

Problem

I've just installed g++ 4.8 on my ubuntu system in order to meet some prerequisites. But now I'm seeing some c++ compilation errors like this one: build command: g++-4.8 -m64 -std=c++0x -c -g -I/usr/include/jsoncpp/json -std=c++0x -MMD -MP -MF build/Debug/GNU-Linux-x86/_ext/803384703/CharNode.o.d -o build/Debug/GNU-Linux-x86/_ext/803384703/CharNode.o ../doublets/CharNode.cpp Error: ``` In file included from /usr/include/x86_64-linux-gnu/c++/4.8/bits/c++config.h:420:0, from /usr/include/c++/4.8/bits/stl_algobase.h:59, from /usr/include/c++/4.8/bits/stl_tree.h:61, from /usr/include/c++/4.8/map:60, from ../doublets/CharNode.h:13, from ../doublets/CharNode.cpp:9: /usr/include/x86_64-linux-gnu/c++/4.8/bits/os_defines.h:44:19: error: missing binary operator before token "(" #if __GLIBC_PREREQ(2,15) && defined(_GNU_SOURCE) ^ ``` It seems to be complaining about the parenthesis? Also, (on other errors) I think there's a version mismatch between wchar.h (c99) and everything else which is c++0x (C11). Any ideas how to get ahold of the c11 standard headers and install them in ubuntu?

Original source