ipkn / crow

Crow is very fast and easy to use C++ micro web framework (inspired by Python Flask)
BSD 3-Clause "New" or "Revised" License
7.47k stars 888 forks source link

build: Undefined symbols for architecture x86_64 in OSX #326

Closed Txiaozhe closed 5 years ago

Txiaozhe commented 5 years ago

set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")

add_executable(crow_demo main.cpp crow_all.h)


* error

Scanning dependencies of target crow_demo [ 50%] Building CXX object CMakeFiles/crow_demo.dir/main.cpp.o [100%] Linking CXX executable crow_demo Undefined symbols for architecture x86_64: "boost::system::system_category()", referenced from: boost::asio::error::get_system_category() in main.cpp.o boost::system::error_code::error_code() in main.cpp.o "boost::system::generic_category()", referenced from: boost::system::error_category::std_category::equivalent(int, std::__1::error_condition const&) const in main.cpp.o boost::system::error_category::std_category::equivalent(std::__1::error_code const&, int) const in main.cpp.o ld: symbol(s) not found for architecture x86_64 clang: error: linker command failed with exit code 1 (use -v to see invocation) make[2]: [crow_demo] Error 1 make[1]: [CMakeFiles/crow_demo.dir/all] Error 2 make: *** [all] Error 2

Txiaozhe commented 5 years ago

set(BOOST_ROOT $ENV{Boost_Dir}) find_package(Boost 1.66.0 COMPONENTS log thread system regex date_time REQUIRED)

set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")

add_executable(crow_demo main.cpp crow_all.h)

link created(required) target

target_link_libraries(crow_demo ${Boost_LIBRARIES})



* Boost_Dir: your boost lib dir, if you install it by homebrew, it will show at installed first time.