0

I want to use the opencv library with code::blocks.

I am using windows 7 Pro x86 os. I've installed Code::Blocks 13.12.

I've download and extract opencv library on my disk (C:\Opencv242).

I also have opencv 2.4.9 and some other versions.

I already tried so much method. I never compilied succesfully. Every time it get me some errors.

Like;

for this code:

#include <opencv2/core/core.hpp>
#include <opencv2/highgui/highgui.hpp>
#include <opencv2/opencv.hpp>
#include <iostream>

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;
}

It getting theese errors to me;

||=== Build: Debug in Opencv (compiler: GNU GCC Compiler) ===| obj\Debug\main.o||In function main':| C:\PROJELER\Software Projects\Opencv\main.cpp|12|undefined reference to cv::imread(std::string const&, int)'| C:\PROJELER\Software Projects\Opencv\main.cpp|14|undefined reference to cv::namedWindow(std::string const&, int)'| C:\PROJELER\Software Projects\Opencv\main.cpp|15|undefined reference to cv::_InputArray::_InputArray(cv::Mat const&)'| C:\PROJELER\Software Projects\Opencv\main.cpp|15|undefined reference to cv::imshow(std::string const&, cv::_InputArray const&)'| C:\PROJELER\Software Projects\Opencv\main.cpp|17|undefined reference tocv::waitKey(int)'| obj\Debug\main.o||In function ZN2cv3MatD1Ev':| C:\PROJELER\Software Projects\Opencv\..\..\..\Opencv242\opencv\build\include\opencv2\core\mat.hpp|278|undefined reference tocv::fastFree(void*)'| obj\Debug\main.o||In function ZN2cv3Mat7releaseEv':| C:\PROJELER\Software Projects\Opencv\..\..\..\Opencv242\opencv\build\include\opencv2\core\mat.hpp|367|undefined reference tocv::Mat::deallocate()'| ||=== Build failed: 7 error(s), 0 warning(s) (0 minute(s), 1 second(s)) ===|

I want to clean install.But i dont know how.

I followed so many person.Last I tried this one;

http://kevinhughes.ca/tutorials/opencv-install-on-windows-with-codeblocks-and-mingw/

I still cant compiling.

Can any one help me how is this?Which way is the right one?

Thanks all of you.

I hope some one help and somehow this problem is solve.

9
  • By the way i forget some details.So sorry.. I've added system path opencv\build\x86\bin, c:\mingw\bin,cmake\bin,codeblocks and some others. Commented May 29, 2014 at 10:04
  • there were a lot of problems with prebuilt mingw libs due to the fact that you have to use exactly the same mingw setup used when compiling the libs, so they ditched that lately. do yourself a favour and build them from the 2.4.9 src using cmake. Commented May 29, 2014 at 10:21
  • Thank you. I ve tried that before. I will try it again. But I don't beleive it will works. I will let you know the result Commented May 30, 2014 at 11:56
  • honestly, the whole mingw thing involves a certain amount of masochism. Commented May 30, 2014 at 12:03
  • I am sorry what is that mean berak? By the way ive tried make the opencv249 with cmake. And i followed zahidhasan tutorial about how onstall win 7 x64 codeblocks. But still dosnt work. Still dosnt compiled. Can any one help???? Commented May 30, 2014 at 16:07

1 Answer 1

-1

You need to add linker directory path. For more info, check this link: OpenCV Codeblocks Setup

Sign up to request clarification or add additional context in comments.

2 Comments

that answer is linking to a 4-year old blog. it's no more relevant, even wrong today.
I cant access that web site.?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.