Failed linking to boost library with CMake generated project file for MSVC9

前端 未结 2 455
离开以前
离开以前 2020-12-06 02:15

I\'m trying to build an application with boost library by creating a MSVC9.0 project files with CMake.

I get the following error:

Error 3 f

2条回答
  •  渐次进展
    2020-12-06 02:47

    After many tries, I was able to compile a project with Boost on Windows. Here is the CMakeLists.txt source:

    cmake_minimum_required (VERSION 2.6)
    
    project (SendCommand)
    
    include_directories(./)
    
    set(BOOST_ROOT F:/boost_1_55_0/)
    set(BOOST_INCLUDEDIR F:/boost_1_55_0/)
    set(BOOST_LIBRARYDIR F:/boost_1_55_0/lib32-msvc-10.0/)
    
    set(Boost_INCLUDE_DIRS F:/boost_1_55_0/)
    set(Boost_LIBRARY_DIRS F:/boost_1_55_0/lib32-msvc-10.0/)
    
    add_definitions(-DBOOST_ALL_NO_LIB)
    
    set(Boost_USE_STATIC_LIBS        ON)
    set(Boost_USE_MULTITHREADED      ON)
    set(Boost_USE_STATIC_RUNTIME    OFF)
    
    find_package(Boost 1.55.0 REQUIRED COMPONENTS system thread)
    
    include_directories(${Boost_INCLUDE_DIRS}) 
    add_executable(SendCommand send_command.cpp ivdlp_packet.cpp) 
    target_link_libraries(SendCommand ${Boost_LIBRARIES})
    

    For more information, you can use a document I've written: https://docs.google.com/document/d/1nE7kYBRQAWbR4rGkMmA5-Hg88M9vS_kAjO4Tc9Rq5zU/pub

提交回复
热议问题