最近在使用boost的asio庫,在mac osx 上編寫網絡服務程序報錯:網絡
:-1: error: symbol(s) not found for architecture x86_64ui
而後在CMakeList.txt的boost 加filesystem systen依賴:spa
find_package(Boost COMPONENTS filesystem system REQUIRED)
而後報了新的錯誤:it
dyld: Library not loaded: libboost_filesystem.dylibio
Referenced from: /Users/xxx/Desktop/project/build-xxxxx-unknown-Default/xxxxxList
Reason: image not foundfile
程序異常結束。 程序
沒有找到庫,咱們在cmake裏面把靜態庫打開便可:im
set(Boost_USE_STATIC_LIBS ON)