본문 바로가기

Skill up/Programming

eclipse에서 boost 사용하는데 에러가 난다..

음.. 문제를 못 찾겠다..


타이머를 사용하려고 boost의 chrono를 사용하려고


#include <boost/chrono.hpp>


했는데.. 에러가 난다.. boost는 설치했다.



아래처럼 에러 나는이유..

 ./src/xxx_main.o: In function `__static_initialization_and_destruction_0':

/usr/include/boost/system/error_code.hpp:214: undefined reference to `boost::system::generic_category()'

/usr/include/boost/system/error_code.hpp:215: undefined reference to `boost::system::generic_category()'

/usr/include/boost/system/error_code.hpp:216: undefined reference to `boost::system::system_category()'

collect2: error: ld returned 1 exit status


library 위치도 설정해줬는데도 그러네..



----------------------------------------------------------------------------------------

다시 시도.


eclipse CDT를 다시 다운로드 받았다. boost 라이브러리는 1.53.0 버젼으로 /usr/local/boost_1_53_0에 설치되어 있다.


그리고, 다른건 바꿔준것은 없고, include와 library path를 다시 설정해줬다.




그런데...도 안된다.


그래서 구글링을 좀 해보니..링커의 -l 옵션에 boost_system을 넣으면 된단다.


 

이러니 된다..ㅡ_ㅡ;;


참고 웹페이지 : http://stackoverflow.com/questions/9723793/undefined-reference-to-boostsystemsystem-category-when-compiling



-----------------------------------------------

참고로, 위의 경우는 직접 최신버젼을 다운받아 설치하고 난뒤의 경우이고,


sudo apt-get install libboost1.50-dev


로 설치를 한 경우에는 위와 같은 문제도 없고, 어떠한 외부라이브러리 설정도 필요없이 사용이 가능한것을 확인하였다.