Mat*_*ins 7 c++ linux ubuntu c++11
我刚刚在我的ubuntu系统上安装了g ++ 4.8,以满足一些先决条件.但现在我看到一些像这样的c ++编译错误:
build命令:
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.od -o build/Debug/GNU-Linux-x86/_ext/803384703/CharNode.o ../doublets/CharNode.cpp
错误:
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)
^
Run Code Online (Sandbox Code Playgroud)
它似乎在抱怨括号?
另外,(关于其他错误)我认为wchar.h(c99)和其他所有c ++ 0x(C11)之间的版本不匹配.有任何想法如何获得c11标准标题并在ubuntu中安装它们?
Mat*_*ins 13
固定.
问题出在构建命令中:
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
Run Code Online (Sandbox Code Playgroud)
该-I命令包括在查找头文件时要搜索的目录.两者os_defines.h和我自己的文件都包含对具有相同名称的不同头文件的引用:features.h.我认为有一个标准的,我正在使用的jsoncpp库中有一个.
问题是-I上面的命令过了一个目录,不应该有/json最后的目录.标准库将此文件称为features.h,并且内部jsoncpp对其自己的features.h文件执行相同操作.
如果我看不起数千个生成的错误,我会看到我自己对jsoncpp库头文件的引用导致"找不到头文件"错误,但我没有得到这么多.