OpenCV just won't run on Code::Blocks [closed]

asked 2018-07-09 06:56:59 -0600

Vladislav gravatar image

updated 2020-09-22 01:25:13 -0600

Hello,

each time I run default program, it just refuses to run.

In function `main':
C:/opencv/buld_cb/wedwedwe/main.cpp:8: undefined reference to `cv::imread(cv::String const&, int)'
C:/opencv/buld_cb/wedwedwe/main.cpp:11: undefined reference to `cv::namedWindow(cv::String const&, int)'
C:/opencv/buld_cb/wedwedwe/main.cpp:12: undefined reference to `cv::imshow(cv::String const&, cv::_InputArray const&)'
C:/opencv/buld_cb/wedwedwe/main.cpp:13: undefined reference to `cv::waitKey(int)'
obj\Debug\main.o: In function `ZN2cv6StringC1EPKc':
C:/opencv/buld_cb/install/include/opencv2/core/cvstd.hpp:602: undefined reference to `cv::String::allocate(unsigned int)'
obj\Debug\main.o: In function `ZN2cv6StringD1Ev':
C:/opencv/buld_cb/install/include/opencv2/core/cvstd.hpp:648: undefined reference to `cv::String::deallocate()'
obj\Debug\main.o: In function `ZN2cv3MatD1Ev':
C:/opencv/buld_cb/install/include/opencv2/core/mat.inl.hpp:704: undefined reference to `cv::fastFree(void*)'
obj\Debug\main.o: In function `ZN2cv3Mat7releaseEv':
C:/opencv/buld_cb/install/include/opencv2/core/mat.inl.hpp:816: undefined reference to `cv::Mat::deallocate()'
collect2.exe: error: ld returned 1 exit status

I'm new to OpenCV and to C++ in general so I have almost no clue what to do. I tried to follow manuals, I did this stuff with CMake building (where I had to delete some AVX stuff in GPU_DISPATCH and then completly disable Python features, because it just won't set up in Code::Blocks either way) and MinGW building after that.

I have paths in my Windows 10 OS for C:\TDM-GCC-64\bin, C:\Program Files\TortoiseGit\bin, C:\Program Files\Git\cmd, C:\Program Files\CMake\bin, C:\MinGW\bin, C:\opencv\buld_cb\bin

In search directories, as a compiler I have C:\opencv\buld_cb\install\include\opencv2, and as a linker I have C:\opencv\buld_cb\lib, both in Debug and Realise. In linker settings, I have all those .a files from C:\opencv\buld_cb\lib

When I make new OpenCV project with such settings as in picture and try to run a default code, it just refuses to do so with errors I copypasted earlier.

my settings when I try to launch an OpenCV project in Code::Blocks

I actually managed to launch OpenCV in Code::Blocks somehow, but I have no clue what to do now to run a program. Help please, thanks.

edit retag flag offensive reopen merge delete

Closed for the following reason question is not relevant or outdated by sturkmen
close date 2020-10-21 09:40:13.824888

Comments

it is a linker problem, so look again, which .a files are added there

berak gravatar imageberak ( 2018-07-09 07:09:40 -0600 )edit

and which files should be there? I honestly don't know, there are 65 .a files

Vladislav gravatar imageVladislav ( 2018-07-09 07:28:57 -0600 )edit

maybe you should put CB aside for a moment, and try a simple:

g++ my.cpp -I C:\opencv\buld_cb\install\include -L  C:\opencv\buld_cb\install\x64\mingw\lib -lopencv_core341 -lopencv_imgcodecs -lopencv_imgproc -lopencv_highgui -o myprog.exe
berak gravatar imageberak ( 2018-07-09 07:42:55 -0600 )edit

I'm sorry, but where do I type this?

Vladislav gravatar imageVladislav ( 2018-07-09 07:47:02 -0600 )edit

ok, forget that idea. can't help here, sorry.

berak gravatar imageberak ( 2018-07-09 07:59:03 -0600 )edit

could anyone help me, please?

Vladislav gravatar imageVladislav ( 2018-07-14 16:53:51 -0600 )edit

please? ;_;

Vladislav gravatar imageVladislav ( 2018-07-19 20:04:08 -0600 )edit