Thread: Boost setup with Xcode

  1. #1
    Registered User
    Join Date
    May 2009

    Boost setup with Xcode

    I'm trying to use Boost for unit testing on Xcode and am having trouble getting things to link properly.

    I put the boost download into the directory (on my Mac with Lion) /usr/local/boost_1_49_0. So that directory has subdirectories such as boost, doc, libs, more and others.

    I'm starting with an ultra simple test that I just copied from the first step of an online tutorial:

    #define BOOST_TEST_MODULE Hello
    #include <boost/test/unit_test.hpp>
    int add(int i, int j) { return i + j; }
    BOOST_AUTO_TEST_CASE(universeInOrder) {
        BOOST_CHECK(add(2, 2) == 5);
    And, when I click on target, I have under Search Paths > Header Search Paths for both debug and release: /usr/local/boost_1_49_0
    That much made the error message disappear for my include that refers to boost.

    But I can't figure out how to get the linker to work properly, so build keeps failing. My current error message is: Library not found for -lboost

    I first tried under Linking > Other Linker Flags just using -lboost (again for both debug and release) and then under Search Paths > Library Search Paths, I've tried /usr/local/boost_1_49_0 as well as /usr/local/boost_1_49_0/boost and /usr/local/boost_1_49_0/libs but none of those seem to work, and I get the same error message.

    Does anyone know how to set this up so that I can use Boost with Xcode?

  2. #2
    Join Date
    Dec 2007
    I first tried under Linking > Other Linker Flags just using -lboost
    This is insufficient. There's no one, single Boost library to which you link; it's functionality-specific. Should the particular Boost functionality you're using even require a library (many are header-only), you need to link that library (and any that it may be dependent on). Perhaps this FAQ entry in the documentation is helpful.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Warning from xcode
    By skiabox in forum C++ Programming
    Replies: 4
    Last Post: 11-25-2010, 08:20 AM
  2. Need help from you Xcode users
    By Memloop in forum Tech Board
    Replies: 7
    Last Post: 09-22-2009, 10:27 AM
  3. XCode and files
    By Fox101 in forum C Programming
    Replies: 7
    Last Post: 12-13-2007, 03:07 PM
  4. erasing elements from a boost::ptr_vector (boost n00b)
    By Marcos in forum C++ Programming
    Replies: 2
    Last Post: 04-04-2006, 12:54 PM
  5. mac os x xcode
    By magus2500x in forum C++ Programming
    Replies: 2
    Last Post: 11-03-2005, 12:12 AM