title: Undefined reference to cv::Exception::Exception - Compiling opencv
body: <p>I'm trying to create a haar classifier following this tutorial: <a href="http://coding-robin.de/2013/07/22/train-your-own-opencv-haar-classifier.html" rel="nofollow">http://coding-robin.de/2013/07/22/train-your-own-opencv-haar-classifier.html</a></p>
  
  <p>I'm at the part where you compile opencv C++ files, with mergevec.cpp, about 1/4th of the way down. I entered </p>
  
  <pre><code>g++ -L C:\opencv\build\x64\vc11\lib -IC:\opencv\build\include\opencv -IC:\opencv\build\include\opencv -IC:\opencv\build\include\opencv2 -I.-o mergevec mergevec.cpp\
      cvboost.cpp cvcommon.cpp cvsamples.cpp cvhaarclassifier.cpp\
      cvhaartraining.cpp\
      -lopencv_core2411 -lopencv_calib3d2411 -lopencv_imgproc2411 -lopencv_highgui2411 -lopencv_objdetect2411 
  </code></pre>
  
  <p>(Pkg-config created a lot of problems for me, so I specified the include and lib directories directly in the command). I got the following output:</p>
  
  <pre><code>C:\Users\nancy\AppData\Local\Temp\cco1Zm1B.o:cvboost.cpp:(.text+0x3f67): undefined reference to `cv::Exception::Exception(int, std::string const&amp;, std::string const&amp;, std::string const&amp;, int)'
  C:\Users\nancy\AppData\Local\Temp\cco1Zm1B.o:cvboost.cpp:(.text+0x3f80): undefined reference to `cv::error(cv::Exception const&amp;)'
  C:\Users\nancy\AppData\Local\Temp\cco1Zm1B.o:cvboost.cpp:(.text+0x3f8f): undefined reference to `cv::Exception::~Exception()'
  C:\Users\nancy\AppData\Local\Temp\cco1Zm1B.o:cvboost.cpp:(.text+0x4106): undefined reference to `cv::Exception::Exception(int, std::string const&amp;, std::string const&amp;, std::string const&amp;, int)'
  C:\Users\nancy\AppData\Local\Temp\cco1Zm1B.o:cvboost.cpp:(.text+0x411f): undefined reference to `cv::error(cv::Exception const&amp;)'
  C:\Users\nancy\AppData\Local\Temp\cco1Zm1B.o:cvboost.cpp:(.text+0x412e): undefined reference to `cv::Exception::~Exception()'
  C:\Users\nancy\AppData\Local\Temp\cco1Zm1B.o:cvboost.cpp:(.text+0x42d2): undefined reference to `cv::Exception::Exception(int, std::string const&amp;, std::string const&amp;, std::string const&amp;, int)'
  C:\Users\nancy\AppData\Local\Temp\cco1Zm1B.o:cvboost.cpp:(.text+0x42eb): undefined reference to `cv::error(cv::Exception const&amp;)'
  C:\Users\nancy\AppData\Local\Temp\cco1Zm1B.o:cvboost.cpp:(.text+0x42fa): undefined reference to `cv::Exception::~Exception()'
  C:\Users\nancy\AppData\Local\Temp\cco1Zm1B.o:cvboost.cpp:(.text+0x447a): undefined reference to `cv::Exception::Exception(int, std::string const&amp;, std::string const&amp;, std::string const&amp;, int)'
  C:\Users\nancy\AppData\Local\Temp\cco1Zm1B.o:cvboost.cpp:(.text+0x4493): undefined reference to `cv::error(cv::Exception const&amp;)'
  C:\Users\nancy\AppData\Local\Temp\cco1Zm1B.o:cvboost.cpp:(.text+0x44a2): undefined reference to `cv::Exception::~Exception()'
  C:\Users\nancy\AppData\Local\Temp\cco1Zm1B.o:cvboost.cpp:(.text+0x4634): undefined reference to `cv::Exception::Exception(int, std::string const&amp;, std::string const&amp;, std::string const&amp;, int)'
  C:\Users\nancy\AppData\Local\Temp\cco1Zm1B.o:cvboost.cpp:(.text+0x464d): undefined reference to `cv::error(cv::Exception const&amp;)'
  C:\Users\nancy\AppData\Local\Temp\cco1Zm1B.o:cvboost.cpp:(.text+0x465c): undefined reference to `cv::Exception::~Exception()'
  C:\Users\nancy\AppData\Local\Temp\cco1Zm1B.o:cvboost.cpp:(.text+0x47e1): undefined reference to `cv::Exception::Exception(int, std::string const&amp;, std::string const&amp;, std::string const&amp;, int)'
  C:\Users\nancy\AppData\Local\Temp\cco1Zm1B.o:cvboost.cpp:(.text+0x47fa): undefined reference to `cv::error(cv::Exception const&amp;)'
  C:\Users\nancy\AppData\Local\Temp\cco1Zm1B.o:cvboost.cpp:(.text+0x4809): undefined reference to `cv::Exception::~Exception()'
  C:\Users\nancy\AppData\Local\Temp\cco1Zm1B.o:cvboost.cpp:(.text+0x49ee): undefined reference to `cv::Exception::Exception(int, std::string const&amp;, std::string const&amp;, std::string const&amp;, int)'
  C:\Users\nancy\AppData\Local\Temp\cco1Zm1B.o:cvboost.cpp:(.text+0x4a07): undefined reference to `cv::error(cv::Exception const&amp;)'
  C:\Users\nancy\AppData\Local\Temp\cco1Zm1B.o:cvboost.cpp:(.text+0x4a16): undefined reference to `cv::Exception::~Exception()'
  C:\Users\nancy\AppData\Local\Temp\cco1Zm1B.o:cvboost.cpp:(.text+0x4b9b): undefined reference to `cv::Exception::Exception(int, std::string const&amp;, std::string const&amp;, std::string const&amp;, int)'
  C:\Users\nancy\AppData\Local\Temp\cco1Zm1B.o:cvboost.cpp:(.text+0x4bb4): undefined reference to `cv::error(cv::Exception const&amp;)'
  C:\Users\nancy\AppData\Local\Temp\cco1Zm1B.o:cvboost.cpp:(.text+0x4bc3): undefined reference to `cv::Exception::~Exception()'
  C:\Users\nancy\AppData\Local\Temp\cco1Zm1B.o:cvboost.cpp:(.text+0x5168): undefined reference to `cv::Exception::~Exception()'
  C:\Users\nancy\AppData\Local\Temp\cco1Zm1B.o:cvboost.cpp:(.text+0x52bc): undefined reference to `cv::Exception::~Exception()'
  C:\Users\nancy\AppData\Local\Temp\cco1Zm1B.o:cvboost.cpp:(.text+0x53db): undefined reference to `cv::Exception::~Exception()'
  C:\Users\nancy\AppData\Local\Temp\cco1Zm1B.o:cvboost.cpp:(.text+0x54fa): undefined reference to `cv::Exception::~Exception()'
  C:\Users\nancy\AppData\Local\Temp\cco1Zm1B.o:cvboost.cpp:(.text+0x5619): more undefined references to `cv::Exception::~Exception()' follow
  
  ...
  
  c:/program files/haskell platform/2014.2.0.0/mingw/bin/../lib/gcc/x86_64-w64-mingw32/4.6.3/../../../../x86_64-w64-mingw32/bin/ld.exe: C:\Users\nancy\AppData\Local\Temp\cco1Zm1B.o: bad reloc address 0x0 in section `.data'
  collect2: ld returned 1 exit status
  </code></pre>
  
  <p>I'm not sure what is causing this error. I'm using the command prompt on a windows 7 machine, and I run it from the directory C:\opencv\sources\apps\haartraining</p>
  
  <p>A copy of my cvboost.cpp, which is in opencv/sources/apps/haartraining can be found at <a href="https://github.com/matitone/OpenCV_Example" rel="nofollow">https://github.com/matitone/OpenCV_Example</a>. I believe this is the file causing the error. </p>
  
  <p>Please let me know if more information would be helpful Thank you.</p>