Występują problemy podczas kompilacji na Ubuntu 16.04 LTS (serwer). Kompiluje się dobrze, jeśli nie dodaję bita -std=c++11
. Wersja Clang to 3.8.uzyskać podstawowy program C++ do kompilacji za pomocą clang ++ na Ubuntu 16
>cat foo.cpp
#include <string>
#include <iostream>
using namespace std;
int main(int argc,char** argv) {
string s(argv[0]);
cout << s << endl;
}
>clang++ -std=c++11 -stdlib=libc++ foo.cpp
In file included from foo.cpp:1:
/usr/include/c++/v1/string:1938:44: error: 'basic_string<_CharT, _Traits, _Allocator>' is missing exception specification
'noexcept(is_nothrow_copy_constructible<allocator_type>::value)'
basic_string<_CharT, _Traits, _Allocator>::basic_string(const allocator_type& __a)
^
/usr/include/c++/v1/string:1326:40: note: previous declaration is here
_LIBCPP_INLINE_VISIBILITY explicit basic_string(const allocator_type& __a)
^
1 error generated.
czy działa bez -stdlib = libC++? – xaxxon
Tak, najwyraźniej. – Darin
, więc to jest pobieranie nagłówków libstdC++, a nie libC++. Myślę, że to normalne w dystrybucji Linuksa. – xaxxon