मैं अपने सिस्टम पर आर्किंक्सक्स चलाने पर clang
संस्करण 4.0.0 का उपयोग कर रहा हूं, यह हमेशा ठीक काम करता है, लेकिन हाल ही में मैं कुछ एसटीएल हेडर का उपयोग करने वाले प्रोग्राम संकलित नहीं कर सकता!क्लैंग <functional> हेडर का उपयोग कर प्रोग्राम संकलित नहीं कर सकता
विवरण:
clang --version
के आउटपुट:
clang version 4.0.0 (tags/RELEASE_400/final)
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /usr/bin
gcc --version
के आउटपुट:
gcc (GCC) 7.1.1 20170528
उदाहरण:
#include <functional>
int main()
{
return 0;
}
मैं निम्न आदेश का उपयोग कर रहा:मैं निम्नलिखित तुच्छ कार्यक्रम संकलन करने की कोशिश की
clang++ -std=c++1z test.cxx
और परिणाम विफलता है:
In file included from test.cxx:3:
In file included from /usr/bin/../lib64/gcc/x86_64-pc-linux-gnu/7.1.1/../../../../include/c++/7.1.1/functional:60:
In file included from /usr/bin/../lib64/gcc/x86_64-pc-linux-gnu/7.1.1/../../../../include/c++/7.1.1/unordered_map:47:
In file included from /usr/bin/../lib64/gcc/x86_64-pc-linux-gnu/7.1.1/../../../../include/c++/7.1.1/bits/hashtable.h:37:
In file included from /usr/bin/../lib64/gcc/x86_64-pc-linux-gnu/7.1.1/../../../../include/c++/7.1.1/bits/node_handle.h:39:
/usr/bin/../lib64/gcc/x86_64-pc-linux-gnu/7.1.1/../../../../include/c++/7.1.1/optional:1032:27: error: use of
class template 'optional' requires template arguments
template <typename _Tp> optional(_Tp) -> optional<_Tp>;
^
/usr/bin/../lib64/gcc/x86_64-pc-linux-gnu/7.1.1/../../../../include/c++/7.1.1/optional:451:11: note: template
is declared here
class optional
^
/usr/bin/../lib64/gcc/x86_64-pc-linux-gnu/7.1.1/../../../../include/c++/7.1.1/optional:1032:40: error:
expected ';' at end of declaration
template <typename _Tp> optional(_Tp) -> optional<_Tp>;
^
/usr/bin/../lib64/gcc/x86_64-pc-linux-gnu/7.1.1/../../../../include/c++/7.1.1/optional:1032:41: error: cannot
use arrow operator on a type
template <typename _Tp> optional(_Tp) -> optional<_Tp>;
^
3 errors generated.
इस में एक बग है एसटीएल या मेरा सेटअप गड़बड़ है?
क्या आपने शामिल करने के आदेश को पुन: व्यवस्थित करने का प्रयास किया है? यह कभी-कभी मेरे लिए कार्यक्रमों का कारण बनता है। या कोशिश करें कि हटाएं # # शामिल करें 'और' # शामिल करें 'मदद करता है या एक अलग त्रुटि –
में मदद करता है आप gcc C++ मानक लाइब्रेरी का उपयोग कर रहे हैं। शायद झुकाव का उपयोग करने की कोशिश करो। कुछ '-stdlib = libC++' की तरह कुछ। – juanchopanza
@ThFl मैंने ' 'के अलावा अन्य सभी शीर्षलेख हटा दिए और समस्या बनी हुई है। मैं मूल प्रश्न संपादित करूंगा। हालांकि धन्यवाद। –
nshct