title: Qt5.1/Qt5.2 + Mac OS 10.9 (Mavericks) + XCode 5.0.2, Undefined symbols for architecture x86_64
body: <p>Environment : Mac OS 10.9 + Qt5.1/Qt5.2 + OpenCV2.4.7 + XCode(5.0.2)</p>
  
  <p>I can compile the following program via terminal </p>
  
  <pre><code>g++ -L/usr/local/lib -lopencv_core -lopencv_highgui \
      -I/usr/local/include  main.cpp
  </code></pre>
  
  <p>The program a.out runs normally.</p>
  
  <p>However, when using Qt 5.1/5.2 to run this OpenCV program, 
  I got "Undefined symbols for architecture x86_64".</p>
  
  <p>However, Qt5 works normally for a simple HelloWorld c++ program.</p>
  
  <p>What is going on ?</p>
  
  <p>Here is the code.</p>
  
  <pre><code>#include &lt;iostream&gt;
  #include "opencv2/highgui/highgui.hpp"
  
  using namespace std ;
  using namespace cv ;
  
  int main()
  {
      Mat img ;
  
      img = imread("image.jpg") ;
  
      return 0;
  }
  </code></pre>
  
  <p>And this is the project setting</p>
  
  <pre><code>INCLUDEPATH += /usr/local/include
  
  LIBS += -L/usr/local/lib
  
  LIBS += -lopencv_core -lopencv_highgui -v
  
  cache()
  
  TEMPLATE = app
  CONFIG += console
  CONFIG -= app_bundle
  CONFIG -= qt
  
  SOURCES += main.cpp
  </code></pre>
  
  <p>Here is the compile message</p>
  
  <pre><code>/Users/XXX/Qt5.2.0/5.2.0-beta1/clang_64/bin/qmake -spec macx-clang CONFIG+=debug -o Makefile /Users/XXX/Desktop/untitled/untitled.pro
  
  /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang++ -headerpad_max_install_names -Wl,-syslibroot
  
  /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk -mmacosx-version-min=10.6 -o untitled main.o   -L/usr/local/lib -lopencv_core -lopencv_highgui -v 
  </code></pre>
  
  <p>with -v to show invocation</p>
  
  <pre><code>Apple LLVM version 5.0 (clang-500.2.79) (based on LLVM 3.3svn)
  Target: x86_64-apple-darwin13.0.0
  Thread model: posix
  
  /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ld" -demangle -dynamic -arch x86_64 -headerpad_max_install_names -macosx_version_min 10.6.0 -o untitled -lcrt1.10.6.o -L/usr/local/lib -syslibroot
  
  /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk main.o -lopencv_core -lopencv_highgui -lstdc++ -lSystem
  
  /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/clang/5.0/lib/darwin/libclang_rt.osx.a
  </code></pre>
  
  <p>And here is the error message</p>
  
  <pre><code>Undefined symbols for architecture x86_64:
  "cv::imread(std::string const&amp;, int)", referenced from:
        _main in main.o
  .... and so on
  </code></pre>
  
  <p>I checked the problem has nothing to do with <code>-lstdc++</code> or <code>-std=c++11</code> or <code>-stdlib=libstdc++</code>.
  by using command line compile.</p>
  
  <p>Any ideas or suggestion?</p>