yldzmuhammed
yldzmuhammed

Reputation: 37

OpenCv Compiling With Code::Blocks on Windows

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.

Upvotes: 0

Views: 4384

Answers (1)

Saurabh Wahile
Saurabh Wahile

Reputation: 67

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

Upvotes: -1

Related Questions