简体   繁体   English

更新到新的 ubuntu 服务器会破坏 g++ 构建并出现一堆 c++/9 错误?

[英]Updating to new ubuntu server breaks g++ build with a bunch of c++/9 errors?

We are moving to a new Ubuntu server (newer Ubuntu version) and the old build is not working.我们正在迁移到新的 Ubuntu 服务器(更新的 Ubuntu 版本),旧版本无法正常工作。 We get tons of errors from c++/9.我们从 c++/9 中得到了大量的错误。 A couple examples below.下面举几个例子。 Any idea how I get the build (a single.cpp file) to work using g++?知道如何使用 g++ 使构建(单个.cpp 文件)工作吗?

/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:

I setup a test.cpp and included the same headers as myapp.cpp and it worked.我设置了一个test.cpp并包含与myapp.cpp相同的标题,并且它有效。 Weird, so I then tried a few #define items included in myapp.cpp and tried again, worked.很奇怪,所以我尝试了myapp.cpp中包含的一些#define项目并再次尝试,成功了。 Now in myapp.cpp the include files for the soap-client.h was down in the middle of the code for CGI support.现在在myapp.cpp中, soap-client.h的包含文件位于CGI支持代码的中间。 I moved the #include for that up to the top with the other #include items and it compiled fine.我将#include与其他#include项目一起移到了顶部,并且编译得很好。

My only thought is there must have been something in the code, either a function , typedef or #define that conflicted with some of the standard headers?我唯一的想法是代码中一定有一些东西,要么是functiontypedef要么#define与某些标准头文件冲突?

Anyway, if you run in to something like that, here is one thing to check.无论如何,如果你遇到类似的事情,这里有一件事要检查。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM