title: Undefined symbols for architecture x86_64: on Qt Creator, I am using OSX 10.10.3
body: <p>I am trying to write a UI for an existing <em>C++</em> project. In order to modify the code, I have to make sure that the original project can run on <em>Qt Creator</em>.</p>
  
  <p>The project requires the use of <em>opencv</em>, I am stuck with setting up opencv on <em>Qt Creator</em>. I am using <em>Qt 5.5</em>, and <em>opencv 2.4.10</em></p>
  
  <p>This is how my <code>.pro</code> looks like:</p>
  
  <pre><code>QT       += core
  QT       -= gui
  
  TARGET = struck  
  CONFIG   += console
  CONFIG   -= app_bundle
  
  TEMPLATE = ap p
  
  INCLUDEPATH += /usr/local/include/opencv
  INCLUDEPATH += /usr/local/include/opencv2
  INCLUDEPATH += /usr/local/include
  
  
  LIBS += -L/usr/local/lib\
  
  -lopencv_core
  -lopencv_highgui
  
  
  
  SOURCES += \
  ../../../../struck_qt/src/GraphUtils/GraphUtils.cpp \
  ../../../../struck_qt/src/Config.cpp \
  ../../../../struck_qt/src/Features.cpp \
  ../../../../struck_qt/src/HaarFeature.cpp \
  ../../../../struck_qt/src/HaarFeatures.cpp \
  ../../../../struck_qt/src/HistogramFeatures.cpp \
  ../../../../struck_qt/src/ImageRep.cpp \
  ../../../../struck_qt/src/LaRank.cpp \
  ../../../../struck_qt/src/main.cpp \
  ../../../../struck_qt/src/MultiFeatures.cpp \
  ../../../../struck_qt/src/RawFeatures.cpp \
  ../../../../struck_qt/src/Sampler.cpp \
  ../../../../struck_qt/src/Tracker.cpp
  
  HEADERS += \
  ../../../../struck_qt/src/GraphUtils/GraphUtils.h \
  ../../../../struck_qt/src/Config.h \
  ../../../../struck_qt/src/Features.h \
  ../../../../struck_qt/src/HaarFeature.h \
  ../../../../struck_qt/src/HaarFeatures.h \
  ../../../../struck_qt/src/HistogramFeatures.h \
  ../../../../struck_qt/src/ImageRep.h \
  ../../../../struck_qt/src/Kernels.h \
  ../../../../struck_qt/src/LaRank.h \
  ../../../../struck_qt/src/MultiFeatures.h \
  ../../../../struck_qt/src/RawFeatures.h \
  ../../../../struck_qt/src/Rect.h \
  ../../../../struck_qt/src/Sample.h \
  ../../../../struck_qt/src/Sampler.h \
  ../../../../struck_qt/src/Tracker.h
  </code></pre>
  
  <p><strong>The error message that I got is following:</strong></p>
  
  <pre><code> Undefined symbols for architecture x86_64:
      "cv::_InputArray::_InputArray(cv::Mat const&amp;)", referenced from:
        ImageRep::ImageRep(cv::Mat const&amp;, bool, bool, bool) in ImageRep.o
        LaRank::Update(MultiSample const&amp;, int) in LaRank.o
        LaRank::Debug() in LaRank.o
        LaRank::UpdateDebugImage() in LaRank.o
        _main in main.o
        RawFeatures::UpdateFeatureVector(Sample const&amp;) in RawFeatures.o
        Tracker::Debug() in Tracker.o
        ...
    "cv::_InputArray::_InputArray(double const&amp;)", referenced from:
        ImageRep::ImageRep(cv::Mat const&amp;, bool, bool, bool) in ImageRep.o
        LaRank::UpdateDebugImage() in LaRank.o
        Tracker::Reset() in Tracker.o
        Tracker::UpdateDebugImage(std::__1::vector&lt;Rect&lt;float&gt;, std::__1::allocator&lt;Rect&lt;float&gt; &gt; &gt; const&amp;, Rect&lt;float&gt; const&amp;, std::__1::vector&lt;double, std::__1::allocator&lt;double&gt; &gt; const&amp;) in Tracker.o
    "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::VideoCapture::open(int)", referenced from:
        _main in main.o
    "cv::VideoCapture::VideoCapture()", referenced from:
        _main in main.o
    "cv::VideoCapture::~VideoCapture()", referenced from:
        _main in main.o
    "cv::VideoCapture::operator&gt;&gt;(cv::Mat&amp;)", referenced from:
        _main in main.o
    "cv::_OutputArray::_OutputArray(cv::Mat&amp;)", referenced from:
        ImageRep::ImageRep(cv::Mat const&amp;, bool, bool, bool) in ImageRep.o
        LaRank::Update(MultiSample const&amp;, int) in LaRank.o
        LaRank::UpdateDebugImage() in LaRank.o
        _main in main.o
        RawFeatures::UpdateFeatureVector(Sample const&amp;) in RawFeatures.o
    "cv::Mat::deallocate()", referenced from:
        cv::Mat::release() in ImageRep.o
        cv::Mat::release() in LaRank.o
        cv::Mat::release() in main.o
        cv::Mat::release() in RawFeatures.o
        cv::Mat::release() in Tracker.o
    "cv::Mat::setTo(cv::_InputArray const&amp;, cv::_InputArray const&amp;)", referenced from:
        ImageRep::ImageRep(cv::Mat const&amp;, bool, bool, bool) in ImageRep.o
        LaRank::UpdateDebugImage() in LaRank.o
        Tracker::Reset() in Tracker.o
        Tracker::UpdateDebugImage(std::__1::vector&lt;Rect&lt;float&gt;, std::__1::allocator&lt;Rect&lt;float&gt; &gt; &gt; const&amp;, Rect&lt;float&gt; const&amp;, std::__1::vector&lt;double, std::__1::allocator&lt;double&gt; &gt; const&amp;) in Tracker.o
    "cv::Mat::create(int, int const*, int)", referenced from:
        cv::Mat::create(int, int, int) in ImageRep.o
        cv::Mat::create(int, int, int) in LaRank.o
        cv::Mat::create(int, int, int) in main.o
        cv::Mat::create(int, int, int) in RawFeatures.o
        cv::Mat::create(int, int, int) in Tracker.o
    "cv::Mat::copySize(cv::Mat const&amp;)", referenced from:
        cv::Mat::Mat(cv::Mat const&amp;) in ImageRep.o
        cv::Mat::operator=(cv::Mat const&amp;) in LaRank.o
        cv::Mat::Mat(cv::Mat const&amp;) in LaRank.o
    "cv::Mat::Mat(cv::Mat const&amp;, cv::Rect_&lt;int&gt; const&amp;)", referenced from:
        cv::Mat::operator()(cv::Rect_&lt;int&gt; const&amp;) const in LaRank.o
        cv::Mat::operator()(cv::Rect_&lt;int&gt; const&amp;) const in RawFeatures.o
    "cv::flip(cv::_InputArray const&amp;, cv::_OutputArray const&amp;, int)", referenced from:
        _main in main.o
    "cv::split(cv::Mat const&amp;, std::__1::vector&lt;cv::Mat, std::__1::allocator&lt;cv::Mat&gt; &gt;&amp;)", referenced from:
        ImageRep::ImageRep(cv::Mat const&amp;, bool, bool, bool) in ImageRep.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:
        LaRank::Debug() in LaRank.o
        _main in main.o
        Tracker::Debug() in Tracker.o
    "cv::resize(cv::_InputArray const&amp;, cv::_OutputArray const&amp;, cv::Size_&lt;int&gt;, double, double, int)", referenced from:
        LaRank::Update(MultiSample const&amp;, int) in LaRank.o
        LaRank::UpdateDebugImage() in LaRank.o
        _main in main.o
        RawFeatures::UpdateFeatureVector(Sample const&amp;) in RawFeatures.o
    "cv::noArray()", referenced from:
        ImageRep::ImageRep(cv::Mat const&amp;, bool, bool, bool) in ImageRep.o
        LaRank::UpdateDebugImage() in LaRank.o
        Tracker::Reset() in Tracker.o
        Tracker::UpdateDebugImage(std::__1::vector&lt;Rect&lt;float&gt;, std::__1::allocator&lt;Rect&lt;float&gt; &gt; &gt; const&amp;, Rect&lt;float&gt; const&amp;, std::__1::vector&lt;double, std::__1::allocator&lt;double&gt; &gt; const&amp;) in Tracker.o
    "cv::waitKey(int)", referenced from:
        _main in main.o
    "cv::cvtColor(cv::_InputArray const&amp;, cv::_OutputArray const&amp;, int, int)", referenced from:
        ImageRep::ImageRep(cv::Mat const&amp;, bool, bool, bool) in ImageRep.o
        LaRank::UpdateDebugImage() in LaRank.o
        _main in main.o
    "cv::fastFree(void*)", referenced from:
        cv::Mat::~Mat() in ImageRep.o
        cv::Mat::~Mat() in LaRank.o
        cv::Mat::~Mat() in main.o
        cv::Mat::~Mat() in RawFeatures.o
        cv::Mat::~Mat() in Tracker.o
    "cv::integral(cv::_InputArray const&amp;, cv::_OutputArray const&amp;, int)", referenced from:
        ImageRep::ImageRep(cv::Mat const&amp;, bool, bool, bool) in ImageRep.o
    "cv::rectangle(cv::Mat&amp;, cv::Point_&lt;int&gt;, cv::Point_&lt;int&gt;, cv::Scalar_&lt;double&gt; const&amp;, int, int, int)", referenced from:
        LaRank::UpdateDebugImage() in LaRank.o
        rectangle(cv::Mat&amp;, Rect&lt;float&gt; const&amp;, cv::Scalar_&lt;double&gt; const&amp;) in main.o
    "cv::Mat::copyTo(cv::_OutputArray const&amp;) const", referenced from:
        ImageRep::ImageRep(cv::Mat const&amp;, bool, bool, bool) in ImageRep.o
        _main in main.o
    "cv::Mat::operator _IplImage() const", referenced from:
        LaRank::UpdateDebugImage() in LaRank.o
    "vtable for cv::_InputArray", referenced from:
        cv::_InputArray::_InputArray(cv::Scalar_&lt;double&gt; const&amp;) in LaRank.o
    NOTE: a missing vtable usually means the first non-inline virtual member function has no definition.
    "_cvCreateImage", referenced from:
        _drawFloatGraph in GraphUtils.o
        _drawIntGraph in GraphUtils.o
        _drawUCharGraph in GraphUtils.o
    "_cvInitFont", referenced from:
        _drawFloatGraph in GraphUtils.o
        _drawIntGraph in GraphUtils.o
        _drawUCharGraph in GraphUtils.o
    "_cvLine", referenced from:
        _drawFloatGraph in GraphUtils.o
        _drawIntGraph in GraphUtils.o
        _drawUCharGraph in GraphUtils.o
    "_cvNamedWindow", referenced from:
        _showFloatGraph in GraphUtils.o
        _showIntGraph in GraphUtils.o
        _showUCharGraph in GraphUtils.o
        _showImage in GraphUtils.o
    "_cvPutText", referenced from:
        _drawFloatGraph in GraphUtils.o
        _drawIntGraph in GraphUtils.o
        _drawUCharGraph in GraphUtils.o
    "_cvReleaseImage", referenced from:
        _showFloatGraph in GraphUtils.o
        _showIntGraph in GraphUtils.o
        _showUCharGraph in GraphUtils.o
    "_cvSet", referenced from:
        _drawFloatGraph in GraphUtils.o
        _drawIntGraph in GraphUtils.o
        _drawUCharGraph in GraphUtils.o
    "_cvShowImage", referenced from:
        _showFloatGraph in GraphUtils.o
        _showIntGraph in GraphUtils.o
        _showUCharGraph in GraphUtils.o
        _showImage in GraphUtils.o
    "_cvWaitKey", referenced from:
        _showFloatGraph in GraphUtils.o
        _showIntGraph in GraphUtils.o
        _showUCharGraph in GraphUtils.o
        _showImage in GraphUtils.o
  ld: symbol(s) not found for architecture x86_64
  clang: error: linker command failed with exit code 1 (use -v to see invocation)
  make: *** [struck] Error 1
  01:10:53: The process "/usr/bin/make" exited with code 2.
  Error while building/deploying project struck (kit: Desktop Qt 5.5.0 clang 64bit)
  When executing step "Make"
  01:10:53: Elapsed time: 00:01.
  </code></pre>
  
  <p>Here are what I have tried and what I am curious about:</p>
  
  <p><strong>1.</strong> There is a post suggested that do use <code>-lopencv_core</code> instead of <code>-libopencv_core2.4.10</code> or <code>libopencv_core</code>. I tried both, neither worked out.</p>
  
  <p><strong>2.</strong> If I delete the line:</p>
  
  <pre><code>LIBS += -L/usr/local/lib\
  
  -lopencv_core
  -lopencv_highgui`
  </code></pre>
  
  <p>The error I got was exactly the same as above. I doubt that I didn't include the library successfully.</p>
  
  <p><strong>3.</strong> A post suggested change <code>qmake.conf</code> from <code>QMAKE_MACOSX_DEPLOYMENT_TARGET = 10.X</code> to <code>QMAKE_MACOSX_DEPLOYMENT_TARGET = 10.10</code>. I did, and it didn't work.</p>
  
  <p><strong>4.</strong> If I do:</p>
  
  <pre><code>LIBS +=     LIBS += -L/usr/local/lib\
  
  LIBS += -lopencv_core
  LIBS += -lopencv_highgui
  </code></pre>
  
  <p>it will claim that the library not found.</p>
  
  <p>I am really concerned about the issue since I really need to set up the project on <em>Qt Creator</em> in order to do further work.</p>
  
  <p>If anybody has any idea on how to solve it, please help me out. Thank you !</p>
  
  <p><strong>NOTE:</strong>
  I only put <code>lopencv_core</code> and <code>-lopencv_highgui</code> there because I have tried include all the titles of opencv libraries there, the error messages are the same.</p>
  
  <p>I double checked that all the <code>.dylib</code> files are in <code>/usr/local/lib</code> </p>