컴파일을 위해 clang 3.1을 사용하는 C++ 11 프로젝트를 가져올 수 없습니다. 컴파일러 명령은 이것이다 :clang libC++ 오류 : overload resolution selected 암시 적으로 삭제 된 복사 할당 연산자
clang++-mp-3.1 -c -std=c++11 -stdlib=libc++ -Wall -g -Iinclude -I/usr/local/include -I/opt/local/include -I/usr/local/include/mongo -o world.o world.cpp
그리고 나는 "-stdlib = libc의 ++"지시문을 포함하기 때문에 내가 얻을 오류는 이것이다 :
이In file included from world.cpp:1:
/usr/include/c++/v1/string:1952:10: error: overload resolution selected implicitly-deleted copy assignment operator
__r_ = _STD::move(__str.__r_);
^
/usr/include/c++/v1/string:1942:9: note: in instantiation of member function 'std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >::__move_assign' requested here
__move_assign(__str, true_type());
^
/usr/include/c++/v1/string:1961:5: note: in instantiation of member function 'std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >::__move_assign' requested here
__move_assign(__str, integral_constant<bool,
^
/usr/include/c++/v1/utility:200:24: note: in instantiation of member function 'std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >::operator=' requested here
struct _LIBCPP_VISIBLE pair
^
/usr/include/c++/v1/memory:1941:5: note: copy assignment operator is implicitly deleted because '__compressed_pair<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>
>::__rep, std::__1::allocator<char> >' has a user-declared move constructor
__compressed_pair(__compressed_pair&& __p)
^
1 error generated.
사람은 내가 어떻게 나를 조언을 할 수 이걸 작동시킬 수 있니?
컴파일하려고하는 파일에이 오류가 발생하는 C++ 11 코드가 포함되어 있지 않아도 "-stdlib = libC++"지시문만으로도 문제가 해결됩니다.
감사합니다. & 모든 도움을 주셔서 감사합니다. Doug.
UPDATE : 하이 - 코드는 아주 기본적인, 그러나 가능한 기본으로하고, 나는이 오류가 건너 온 :
Undefined symbols for architecture x86_64:
"std::__1::cout", referenced from:
_main in world.o
"std::__1::basic_ostream<char, std::__1::char_traits<char> >::sentry::sentry(std::__1::basic_ostream<char, std::__1::char_traits<char> >&)", referenced from:
std::__1::basic_ostream<char, std::__1::char_traits<char> >& std::__1::operator<< <std::__1::char_traits<char> >(std::__1::basic_ostream<char, std::__1::char_traits<char> >&, char const*) in world.o
"std::__1::ios_base::clear(unsigned int)", referenced from:
std::__1::basic_ostream<char, std::__1::char_traits<char> >& std::__1::operator<< <std::__1::char_traits<char> >(std::__1::basic_ostream<char, std::__1::char_traits<char> >&, char const*) in world.o
"std::__1::basic_ostream<char, std::__1::char_traits<char> >::sentry::~sentry()", referenced from:
std::__1::basic_ostream<char, std::__1::char_traits<char> >& std::__1::operator<< <std::__1::char_traits<char> >(std::__1::basic_ostream<char, std::__1::char_traits<char> >&, char const*) in world.o
"std::__1::ios_base::__set_badbit_and_consider_rethrow()", referenced from:
std::__1::basic_ostream<char, std::__1::char_traits<char> >& std::__1::operator<< <std::__1::char_traits<char> >(std::__1::basic_ostream<char, std::__1::char_traits<char> >&, char const*) in world.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
이 오류를 얻으려면, 내가 벗겨 다시이 내 코드 :
#include <iostream>
int main(int argc, char *argv[])
{
std::cout << "Hi.\n";
}
이는 매우 근본적으로 잘못된 것으로 보입니다.
컴파일러에 "-stdlib = libC++"지시문을 가져올 때이 오류가 표시되지 않습니다.
코드를 입력하십시오. – ForEveR
안녕하세요 - 게시물에 추가했지만 코드에 문제가 없다고 확신합니다. Macport와 함께 설치했지만 내 Clang이 borked 수도 있습니다. – biot023
Mac OSX Lion을 사용하고 있습니까? – mavam