How to create a simple acceleration program on Mac OS (Lion)

Steps:
1.sudo port boost
The amplified file installed in / opt / local / boost, the library files are in / opt / local / lib

2. use Xcode to create a C ++ project

#include <iostream> #include <boost/asio.hpp> int main () { return 0; } 


3. Install Xcode to learn how to increase it in the "Build Settings" → "HEADER_SEARCH_PATHS"
in both Debug and Release add path / opt / local / include

4. "Build settings" → "LIBRARY_SEARCH_PATHS" → add / opt / local / lib both for debugging and for release.

5. Create a program and failed.
Error messages

 Undefined symbols for architecture x86_64: "boost::system::generic_category()", referenced from: ___cxx_global_var_init1 in main.o ___cxx_global_var_init2 in main.o "boost::system::system_category()", referenced from: ___cxx_global_var_init3 in main.o boost::asio::error::get_system_category() in main.o "boost::asio::error::get_netdb_category()", referenced from: ___cxx_global_var_init5 in main.o <br> "boost::asio::error::get_addrinfo_category()", referenced from: ___cxx_global_var_init6 in main.o <br> "boost::asio::error::get_misc_category()", referenced from: ___cxx_global_var_init7 in main.o <br> ld: symbol(s) not found for architecture x86_64 clang: error: linker command failed with exit code 1 (use -v to see invocation) 

Am I mistaken in the procedure?

+6
source share
2 answers

You need to associate with Boost.System , which should be in /opt/local/lib/libboost_system (with some suffix, which depends on how you created boost)

Add this to your Xcode project.

+8
source
  • choose for your "goals"
  • in the "Linking binaries to libraries" section of the "build phase" tab, add the boost library.
  • if installed via MacPort, the boost will be in /opt/local/lib ,
    if installed via brew, the boost will be in /usr/local/Cellar/boost ,
    if it is built on its own, it will be in /usr/local/lib by default or yourBoostLib/stage/lib
+4
source

Source: https://habr.com/ru/post/917924/


All Articles