title: OpenCv Compiling With Code::Blocks on Windows
body: <p>I want to use the opencv library with code::blocks.</p>
  
  <p>I am using windows 7 Pro x86 os. I've installed Code::Blocks 13.12.</p>
  
  <p>I've download and extract opencv library on my disk (C:\Opencv242).</p>
  
  <p>I also have opencv 2.4.9 and some other versions.</p>
  
  <p>I already tried so much method. I never compilied succesfully. Every time it get me some errors.</p>
  
  <p>Like;</p>
  
  <p>for this code:</p>
  
  <pre><code>#include &lt;opencv2/core/core.hpp&gt;
  #include &lt;opencv2/highgui/highgui.hpp&gt;
  #include &lt;opencv2/opencv.hpp&gt;
  #include &lt;iostream&gt;
  
  using namespace std;
  using namespace cv;
  
  int main()
  {
  
  Mat img = imread("C:\\PROJELER\\Software Projects\\Opencv\\pic.jpg", CV_LOAD_IMAGE_COLOR);
  
  namedWindow("MyWindow", CV_WINDOW_AUTOSIZE);
  imshow("MyWindow", img);
  
  waitKey(0);
  return 0;
  }
  </code></pre>
  
  <p>It getting theese errors to me;</p>
  
  <blockquote>
    <p>||=== Build: Debug in Opencv (compiler: GNU GCC Compiler) ===|
    obj\Debug\main.o||In function <code>main':| C:\PROJELER\Software
    Projects\Opencv\main.cpp|12|undefined reference to
    </code>cv::imread(std::string const&amp;, int)'| C:\PROJELER\Software
    Projects\Opencv\main.cpp|14|undefined reference to
    <code>cv::namedWindow(std::string const&amp;, int)'| C:\PROJELER\Software
    Projects\Opencv\main.cpp|15|undefined reference to
    </code>cv::_InputArray::_InputArray(cv::Mat const&amp;)'| C:\PROJELER\Software
    Projects\Opencv\main.cpp|15|undefined reference to
    <code>cv::imshow(std::string const&amp;, cv::_InputArray const&amp;)'|
    C:\PROJELER\Software Projects\Opencv\main.cpp|17|undefined reference
    to</code>cv::waitKey(int)'| obj\Debug\main.o||In function <code>ZN2cv3MatD1Ev':|
    C:\PROJELER\Software
    Projects\Opencv\..\..\..\Opencv242\opencv\build\include\opencv2\core\mat.hpp|278|undefined
    reference to</code>cv::fastFree(void*)'| obj\Debug\main.o||In function
    <code>ZN2cv3Mat7releaseEv':| C:\PROJELER\Software
    Projects\Opencv\..\..\..\Opencv242\opencv\build\include\opencv2\core\mat.hpp|367|undefined
    reference to</code>cv::Mat::deallocate()'| ||=== Build failed: 7 error(s),
    0 warning(s) (0 minute(s), 1 second(s)) ===|</p>
  </blockquote>
  
  <p>I want to clean install.But i dont know how.</p>
  
  <p>I followed so many person.Last I tried this one;</p>
  
  <p><a href="http://kevinhughes.ca/tutorials/opencv-install-on-windows-with-codeblocks-and-mingw/" rel="nofollow">http://kevinhughes.ca/tutorials/opencv-install-on-windows-with-codeblocks-and-mingw/</a></p>
  
  <p>I still cant compiling.</p>
  
  <p>Can any one help me how is this?Which way is the right one?</p>
  
  <p>Thanks all of you.</p>
  
  <p>I hope some one help and somehow this problem is solve.</p>