0
我想在使用MinGW和CMake的Windows上使用Boost庫v1.60.0構建項目。我是能夠成功地與MinGW的有以下建設加速:CMake Boost靜態庫未定義參考boost :: chrono :: steady_clock :: now()
cd <boost_root>\tools\build
bootstrap.bat gcc
cd ..\..
tools\build\b2.exe --prefix=<boost_install_root> toolset=gcc link=static
現在,當我通過CMake的構建我的應用程序做這樣的:
add_executable(myApp ... .cpp sources ...)
target_include_directories(myApp <myApp include directory> ${Boost_INCLUDE_DIRS})
target_link_libraries(myApp ${Boost_LIBRARIES})
,我得到幾個錯誤都幾乎相同:
<boost_install_root>/lib/libboost_timer-mgw53-mt-1_60.a(cpu_timer.o):cpu_ timer.cpp:(.text+0x25a): undefined reference to `boost::chrono::steady_clock::now()'
這些庫都在那裏,從我可以告訴的CMake中可見,所以我錯過了什麼?
是你的Boost組件列表中的計時庫,即'find_package(Boost 1.60.0 REQUIRED COMPONENTS chrono)'? – utopia
是的,我用這個'find_packages(Boost 1.60.0 REQUIRED COMPONENTS文件系統系統線程date_time正則表達式計時器OPTIONAL_COMPONENTS日誌log_setup' – MrJman006
你的CMake最近夠了嗎? – usr1234567