2016-09-15 6 views
1

내가 코드 어떻게하면 프로젝트에 부스트 라이브러리를 연결할 수 있습니까?

#include <iostream> 
#include <boost/thread/thread.hpp> 

using namespace std; 

void f1() 
{ 
    cout <<"Hello world, I'm a thread1!"<<endl; 
} 

int main() 
{ 
    boost::thread t1(&f1); 
return 0; 
} 

을 작성하고 내가 이러한 오류

build-test_not_qt_1-Desktop-Debug/main.o:-1: In function boost::detail::thread_data_base::thread_data_base()': /build-test_not_qt_1-Desktop-Debug/main.o:-1: In function boost::detail::thread_data_base::thread_data_base()': build-test_not_qt_1-Desktop-Debug/main.o:-1: In function boost::thread::start_thread()': build-test_not_qt_1-Desktop-Debug/main.o:-1: In function boost::thread::start_thread()': build-test_not_qt_1-Desktop-Debug/main.o:-1: In function boost::thread::~thread()': build-test_not_qt_1-Desktop-Debug/main.o:-1: In function boost::thread::~thread()': build-test_not_qt_1-Desktop-Debug/main.o:-1: In function boost::detail::thread_data<void (*)()>::~thread_data()': /usr/include/boost/thread/detail/thread.hpp:91: error: undefined reference to boost::detail::thread_data_base::~thread_data_base()' (.rodata._ZTIN5boost6detail11thread_dataIPFvvEEE[_ZTIN5boost6detail11thread_dataIPFvvEEE]+0x10):-1: error: undefined reference to `typeinfo for boost::detail::thread_data_base' :-1: error: collect2: error: ld returned 1 exit status

내가 그들을 해결할 수있는 방법을 왔

LIBS += -L/usr/lib/x86_64-linux-gnu -lboost_system

Qt는 창조주 프로 파일에 문자열을 추가 한 ? 응용 프로그램을 작동하게하려면 어떻게해야합니까?

+5

'boost_system'은 시스템 특정 기능을위한 부스트 라이브러리입니다. 당신은'boost_thread'를 원한다. – Hayt

답변

2
LIBS += -L/usr/lib/x86_64-linux-gnu -lboost_system -lboost_thread 
관련 문제