title: OpenCV Unresolved symbols - name mangling mismatch - xcode
body: <p>I built the i386 flavor of OpenCV locally on my Macbook running Lion, by using </p>
  
  <pre><code>cmake -G "Unix Makefiles" -D CMAKE_OSX_ARCHITECTURES=i386 -D CMAKE_C_FLAGS=-m32 -D CMAKE_CXX_FLAGS=-m32 ..
  make -j8
  sudo make install
  </code></pre>
  
  <p>Libraries built and published fine, and I've added them to my xcode project. 
  However, there are link errors when building my test app, and they seem to be name mangling issues.</p>
  
  <p><code>Undefined symbols for architecture i386:
    "cv::namedWindow(std::__1::basic_string&lt;char, std::__1::char_traits&lt;char&gt;, std::__1::allocator&lt;char&gt; &gt; const&amp;, int)", referenced from:
        _main in main.o
    "cv::imread(std::__1::basic_string&lt;char, std::__1::char_traits&lt;char&gt;, std::__1::allocator&lt;char&gt; &gt; const&amp;, int)", referenced from:
        _main in main.o
    "cv::imshow(std::__1::basic_string&lt;char, std::__1::char_traits&lt;char&gt;, std::__1::allocator&lt;char&gt; &gt; const&amp;, cv::_InputArray const&amp;)", referenced from:
        _main in main.o</code></p>
  
  <p>Taking cv::imread as an example, it is exported from libopencv_highgui.dylib with the name:</p>
  
  <pre><code>00007510 (__TEXT,__text) external __ZN2cv6imreadERKSsi 
  </code></pre>
  
  <p>while main.o is referencing the symbol </p>
  
  <pre><code>U __ZN2cv6imreadERKNSt3__112basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEEi
  </code></pre>
  
  <p>On the other hand, function <code>__ZN2cv7waitKeyEi</code> from the same dylib links fine.</p>
  
  <p>Both the test app and the framework are for i386 arch. </p>
  
  <p>Any ideas what might be causing this issue?</p>