更新到新的 ubuntu 服务器会中断 g++ 构建并出现一堆 c++/9 错误?
Updating to new ubuntu server breaks g++ build with a bunch of c++/9 errors?
我们正在迁移到新的 Ubuntu 服务器(较新的 Ubuntu 版本),旧版本无法正常工作。我们从 c++/9 中得到了大量的错误。下面是几个例子。知道如何让构建(单个 .cpp 文件)使用 g++ 工作吗?
/usr/include/c++/9/array: In function 'bool std::operator<(const std::array<_Tp, _Nm>&, const std::array<_Tp, _Nm>&)':
/usr/include/c++/9/array:264:19: error: 'lexicographical_compare' is not a member of 'std'; did you mean 'lexicographical_compare'?
264 | return std::lexicographical_compare(__a.begin(), __a.end(),
| ^~~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/9/memory:62,
from /usr/include/unicode/localpointer.h:45,
from /usr/include/unicode/uenum.h:23,
from /usr/include/unicode/ucnv.h:53,
from /usr/include/libxml2/libxml/encoding.h:31,
from /usr/include/libxml2/libxml/parser.h:810,
from /usr/include/libxml2/libxml/xmlerror.h:10,
from /usr/include/libxml2/libxml/xpath.h:26,
from /usr/local/include/libcsoap-1.1/libcsoap/soap-xml.h:27,
from /usr/local/include/libcsoap-1.1/libcsoap/soap-env.h:29,
from /usr/local/include/libcsoap-1.1/libcsoap/soap-client.h:27,
from myapp.cpp:6318:
/usr/include/c++/9/bits/stl_algobase.h:1277:5: note: 'lexicographical_compare' declared here
1277 | lexicographical_compare(_II1 __first1, _II1 __last1,
| ^~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/9/array: In member function 'void std::array<_Tp, _Nm>::fill(const value_type&)':
/usr/include/c++/9/array:117:14: error: 'fill_n' is not a member of 'std'; did you mean 'fill_n'?
117 | { std::fill_n(begin(), size(), __u); }
| ^~~~~~
In file included from /usr/include/c++/9/memory:62,
from /usr/include/unicode/localpointer.h:45,
from /usr/include/unicode/uenum.h:23,
from /usr/include/unicode/ucnv.h:53,
from /usr/include/libxml2/libxml/encoding.h:31,
from /usr/include/libxml2/libxml/parser.h:810,
from /usr/include/libxml2/libxml/xmlerror.h:10,
from /usr/include/libxml2/libxml/xpath.h:26,
from /usr/local/include/libcsoap-1.1/libcsoap/soap-xml.h:27,
from /usr/local/include/libcsoap-1.1/libcsoap/soap-env.h:29,
from /usr/local/include/libcsoap-1.1/libcsoap/soap-client.h:27,
from myapp.cpp:6318:
我设置了一个 test.cpp
并包含了与 myapp.cpp
相同的 headers 并且它起作用了。很奇怪,所以我随后尝试了 myapp.cpp
中包含的一些 #define
项,然后再次尝试,成功了。现在 myapp.cpp
soap-client.h
的包含文件位于 CGI
支持的代码中间。我将 #include
与其他 #include
项一起移至顶部,并且编译正常。
我唯一的想法是代码中一定有什么东西,function
、typedef
或 #define
与某些标准 headers 冲突?
无论如何,如果您 运行 喜欢这样的事情,请检查一件事。
我们正在迁移到新的 Ubuntu 服务器(较新的 Ubuntu 版本),旧版本无法正常工作。我们从 c++/9 中得到了大量的错误。下面是几个例子。知道如何让构建(单个 .cpp 文件)使用 g++ 工作吗?
/usr/include/c++/9/array: In function 'bool std::operator<(const std::array<_Tp, _Nm>&, const std::array<_Tp, _Nm>&)':
/usr/include/c++/9/array:264:19: error: 'lexicographical_compare' is not a member of 'std'; did you mean 'lexicographical_compare'?
264 | return std::lexicographical_compare(__a.begin(), __a.end(),
| ^~~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/9/memory:62,
from /usr/include/unicode/localpointer.h:45,
from /usr/include/unicode/uenum.h:23,
from /usr/include/unicode/ucnv.h:53,
from /usr/include/libxml2/libxml/encoding.h:31,
from /usr/include/libxml2/libxml/parser.h:810,
from /usr/include/libxml2/libxml/xmlerror.h:10,
from /usr/include/libxml2/libxml/xpath.h:26,
from /usr/local/include/libcsoap-1.1/libcsoap/soap-xml.h:27,
from /usr/local/include/libcsoap-1.1/libcsoap/soap-env.h:29,
from /usr/local/include/libcsoap-1.1/libcsoap/soap-client.h:27,
from myapp.cpp:6318:
/usr/include/c++/9/bits/stl_algobase.h:1277:5: note: 'lexicographical_compare' declared here
1277 | lexicographical_compare(_II1 __first1, _II1 __last1,
| ^~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/9/array: In member function 'void std::array<_Tp, _Nm>::fill(const value_type&)':
/usr/include/c++/9/array:117:14: error: 'fill_n' is not a member of 'std'; did you mean 'fill_n'?
117 | { std::fill_n(begin(), size(), __u); }
| ^~~~~~
In file included from /usr/include/c++/9/memory:62,
from /usr/include/unicode/localpointer.h:45,
from /usr/include/unicode/uenum.h:23,
from /usr/include/unicode/ucnv.h:53,
from /usr/include/libxml2/libxml/encoding.h:31,
from /usr/include/libxml2/libxml/parser.h:810,
from /usr/include/libxml2/libxml/xmlerror.h:10,
from /usr/include/libxml2/libxml/xpath.h:26,
from /usr/local/include/libcsoap-1.1/libcsoap/soap-xml.h:27,
from /usr/local/include/libcsoap-1.1/libcsoap/soap-env.h:29,
from /usr/local/include/libcsoap-1.1/libcsoap/soap-client.h:27,
from myapp.cpp:6318:
我设置了一个 test.cpp
并包含了与 myapp.cpp
相同的 headers 并且它起作用了。很奇怪,所以我随后尝试了 myapp.cpp
中包含的一些 #define
项,然后再次尝试,成功了。现在 myapp.cpp
soap-client.h
的包含文件位于 CGI
支持的代码中间。我将 #include
与其他 #include
项一起移至顶部,并且编译正常。
我唯一的想法是代码中一定有什么东西,function
、typedef
或 #define
与某些标准 headers 冲突?
无论如何,如果您 运行 喜欢这样的事情,请检查一件事。