未定义符号 boost::system:detail::system_category_instance
Undefined symbol boost::system:detail::system_category_instance
在编译使用 beast 和 asio[=32= 的游乐场程序时,我在 macOS Mojave 上使用 c++17 标准和 clang 构建了 boost ] 我收到以下错误:
这是我的 make 文件:
cmake_minimum_required (VERSION 3.13.1)
project (Playground)
set(Boost_USE_STATIC_LIBS ON)
set(Boost_USER_MULITHREADED ON)
set(Boost_USE_STATIC_RUNTIME OFF)
set(BOOST_ROOT "/usr/local/boost-1.68.0")
set(Boost_INLCUDE_DIR "/usr/local/boost-1.68.0/include")
set(Boost_LIBRARY_DIR_RELEASE "/usr/local/boost-1.68.0/lib")
find_package(Boost 1.68.0 REQUIRED COMPONENTS system filesystem)
set(SOURCES
src/main.cpp
src/http_client/http_client.hpp
src/http_client/http_client.cpp)
if(Boost_FOUND)
include_directories("/usr/local/boost-1.68.0/include")
add_executable (Playground ${SOURCES})
set_property(TARGET Playground PROPERTY CXX_STANDARD 17)
target_include_directories(Playground PRIVATE ${BOOST_INCLUDE_DIRS})
target_link_libraries(Playground ${BOOST_FILESYSTEM_LIBRARIES}
${BOOST_SYSTEM_LIBRARIES})
endif()
我已经按照本教程中描述的步骤编译了 boost:
Compiling Boost with Clang.
Clang 版本:
Apple LLVM 版本 10.0.0.0 (clang-1000.11.45.5)
目标:x86_64-apple-darwin18.2.0
还有什么我需要考虑的吗?我已经阅读了很多帖子等,其中建议以项目本身应使用的相同 C++ 标准编译 boost。
编辑:
Matthieu Brucher 对变量名的提示(Boost_ 与 BOOST_)起到了作用。现在可以使用了。
@Matthieu Brucher 对变量名的提示(Boost_ 与 BOOST_)起到了作用:
target_link_libraries(Playground ${Boost_FILESYSTEM_LIBRARY}
${Boost_SYSTEM_LIBRARY})
在编译使用 beast 和 asio[=32= 的游乐场程序时,我在 macOS Mojave 上使用 c++17 标准和 clang 构建了 boost ] 我收到以下错误:
这是我的 make 文件:
cmake_minimum_required (VERSION 3.13.1)
project (Playground)
set(Boost_USE_STATIC_LIBS ON)
set(Boost_USER_MULITHREADED ON)
set(Boost_USE_STATIC_RUNTIME OFF)
set(BOOST_ROOT "/usr/local/boost-1.68.0")
set(Boost_INLCUDE_DIR "/usr/local/boost-1.68.0/include")
set(Boost_LIBRARY_DIR_RELEASE "/usr/local/boost-1.68.0/lib")
find_package(Boost 1.68.0 REQUIRED COMPONENTS system filesystem)
set(SOURCES
src/main.cpp
src/http_client/http_client.hpp
src/http_client/http_client.cpp)
if(Boost_FOUND)
include_directories("/usr/local/boost-1.68.0/include")
add_executable (Playground ${SOURCES})
set_property(TARGET Playground PROPERTY CXX_STANDARD 17)
target_include_directories(Playground PRIVATE ${BOOST_INCLUDE_DIRS})
target_link_libraries(Playground ${BOOST_FILESYSTEM_LIBRARIES}
${BOOST_SYSTEM_LIBRARIES})
endif()
我已经按照本教程中描述的步骤编译了 boost: Compiling Boost with Clang.
Clang 版本:
Apple LLVM 版本 10.0.0.0 (clang-1000.11.45.5)
目标:x86_64-apple-darwin18.2.0
还有什么我需要考虑的吗?我已经阅读了很多帖子等,其中建议以项目本身应使用的相同 C++ 标准编译 boost。
编辑:
Matthieu Brucher 对变量名的提示(Boost_ 与 BOOST_)起到了作用。现在可以使用了。
@Matthieu Brucher 对变量名的提示(Boost_ 与 BOOST_)起到了作用:
target_link_libraries(Playground ${Boost_FILESYSTEM_LIBRARY}
${Boost_SYSTEM_LIBRARY})