title: Link with Boost (Homebrew) Mac c++
body: <p>Hello I'm trying to link with boost to use the threading library, but can not seem to get it built.</p>
  
  <p>I installed boost with HomeBrew (mac package installer) and it is in the <code>/usr/local/Cellar/boost/1.50.0</code> directory.</p>
  
  <p>My main file is very simple right now...</p>
  
  <pre><code>#include &lt;iostream&gt;
  #include &lt;boost/thread.hpp&gt;
  </code></pre>
  
  <p>My make file is like this:</p>
  
  <pre><code>CC = g++
  
  
  BASE_FLAGS = -m32 -wAll
  
  # INCLUDE BASE DIRECTORY AND BOOST DIRECTORY FOR HEADERS
  LDFLAGS = -I/usr/local/Cellar/boost/1.50.0/include -I/opt/local/include
  
  # INCLUDE BASE DIRECTORY AND BOOST DIRECTORY FOR LIB FILES
  LLIBFLAGS = -L/usr/local/Cellar/boost/1.50.0/
  
  # SPECIFIY LINK OPTIONS
  LINKFLAGS = -l boost_thread-mt -lboost_system
  
  # FINAL FLAGS -- TO BE USED THROUGHOUT
  FLAGS = $(BASE_FLAGS) $(LLIBFLAGS) $(LDFLAGS) $(LINKFLAGS)
  
  
  
  
  # NOTE FOR BOOST -- YOU ONLY NEED TO INCLUDE THE PATH BECAUSE IT ONLY INSTALLS HEADER FILES
  main: main.cpp
      $(CC) $(FLAGS) -o main.out main.cpp
  </code></pre>
  
  <p>And when I run this, I get a library not found for boost_system. If i take out the boost_system, then I get an error that looks like this:</p>
  
  <pre><code>ld: warning: ignoring file /usr/local/lib/libboost_thread-mt.dylib, file was built for unsupported file format ( 0xcf 0xfa 0xed 0xfe 0x 7 0x 0 0x 0 0x 1 0x 3 0x 0 0x 0 0x 0 0x 6 0x 0 0x 0 0x 0 ) which is not the architecture being linked (i386): /usr/local/lib/libboost_thread-mt.dylib
  Undefined symbols for architecture i386:
    "boost::system::system_category()", referenced from:
        __static_initialization_and_destruction_0(int, int)in ccKwJWzr.o
    "boost::system::generic_category()", referenced from:
        __static_initialization_and_destruction_0(int, int)in ccKwJWzr.o
  ld: symbol(s) not found for architecture i386
  collect2: ld returned 1 exit status
  make: *** [main] Error 1
  </code></pre>