我們正在遷移到新的 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:
uj5u.com熱心網友回復:
我設定了一個test.cpp并包含myapp.cpp與它相同的標題并且它有效。很奇怪,所以我然后嘗試了#define其中包含的一些專案myapp.cpp并再次嘗試,成功了。現在在myapp.cpp包含檔案soap-client.h的中間代碼中得到了CGI支持。我將#includefor that 與其他#include專案一起移到頂部,它編譯得很好。
我唯一的想法是代碼中一定有一些東西,要么 a function,typedef要么#define與某些標準頭檔案沖突?
無論如何,如果你遇到類似的事情,這里有一件事要檢查。
轉載請註明出處,本文鏈接:https://www.uj5u.com/qianduan/407809.html
標籤:
