5
표준 템플릿 라이브러리에서 멀티 스레딩 프로그램을 컴파일하는 데 문제가 있습니다.C++의 std :: thread와 관련된 문제 11
g ++ : 나는 그것을 컴파일
/tmp/ccE8EtL1.o : In the function « std::thread::thread<void (&)()>(void (&)()) » : file.cpp:(.text._ZNSt6threadC2IRFvvEJEEEOT_DpOT0_[_ZNSt6threadC5IRFvvEJEEEOT_DpOT0_]+0x21) : undefined reference to « pthread_create » collect2: error : ld has return 1 execution status code
:
#include <iostream> #include <thread> void foo() { std::cout << "Thread 1\n"; } int main(int argc, char** argv) { std::thread tr(foo); std::cout << "Main thread\n"; tr.join(); return 0; }
내가 오류를 이해하지 않는다 : 나는 다음과 같은 프로그램을 컴파일 할 때 그것은 나에게 모호한 오류를 반환 -std = C++ 14 file.cpp -o test -Wall
누구든지 도움을 줄 수 있습니까? 나 제발?
고맙습니다. 솔루션 \ O / – Harry333Cover