How to Use OpenCV 2.48 with CodeBlock on Windows7 , 64 bit [closed]

asked 2014-07-06 18:07:02 -0500

Need help. I have been using codeblock and openCV using IplImage etc. Developed and used many examples but all IplImage manipulation. Now I want to use mat feature. I am unable to configure CodeBlock with openCV , I have downloaded MinGw ( complete size around 1.3 GB ) , Tried various version of CodeBlock, the best working with me is Version CodeBlock 10.05. with Mingw , but I have not used that : no link , no reference in path / libraries

I have tried to use Cmake to make binaries of MinGW but no success, so deleted all data of CMake and what it produced.

My Path includes ( MinGW is placed in E:\MinGW )

E:\MinGW\bin; E:\MinGW\mingw32\bin; C:\opencv248\opencv\build\x86\vc10\bin ; D:\path ;

I have configures CodeBlock as under:-

Using code::blocks-10.04 for OpenCV 2.4.8 , in Windows 7 64 bit.

Open code::blocks go to Setting->Compiler and debugger, then a popup window opens.

I selected Search directories tab, and below select Compiler tab, gave OpenCV include path,

image description

C:\opencv248\opencv\build\include\opencv2
C:\opencv248\opencv\build\include\opencv C:\opencv248\opencv\build\include E:\MinGW\include

Then I Clicked on Linker tab next to Compiler tab added OpenCV bin directory, like image description

C:\opencv248\opencv\build\x86\vc10\bin , here I used 32 bit binaries. e:\MinGW\bin

Now open Linker settings tab and below Link libraries add OpenCV libraries, image description

E:\MinGW\lib\libaclui.a etc there are many files Also added all files like this open : E:\MinGW\mingw32\lib\libwin32spl.a

Toolchain is configures for e:\MinGW as shown image description

I also set the Build Options image description

then

image description

and

image description

next

image description

I get these errors
Linking console executable: bin\Release\brave.exe build Log :

e:/mingw/bin/../lib/gcc/mingw32/4.8.1/../../../../mingw32/bin/ld.exe: cannot find C:\opencv248\opencv\build\x86\vc10\bin: Permission denied e:/mingw/bin/../lib/gcc/mingw32/4.8.1/../../../../mingw32/bin/ld.exe: cannot find E:\MinGW\bin: Permission denied e:/mingw/bin/../lib/gcc/mingw32/4.8.1/../../../../mingw32/bin/ld.exe: cannot find E:\MinGW\mingw32\bin: Permission denied

collect2.exe: error: ld returned 1 exit status

Process terminated with status 1 (0 minutes, 1 seconds)

3 errors, 0 warnings

image description

and image description

Build messages

ld.exe cannot find C:\opencv248\opencv\build\x86\vc10\bin: Permission denied ld.exe cannot find E:\MinGW\bin: Permission denied ld.exe cannot find E:\MinGW\mingw32\bin: Permission denied === Build finished: 3 errors, 0 warnings ===

edit retag flag offensive reopen merge delete

Closed for the following reason the question is answered, right answer was accepted by StevenPuttemans
close date 2014-07-09 04:16:31.627676

Comments

1

C:\opencv248\opencv\build\x86\vc10\bin - that's wrong.

you can't use the visual studio libs with mingw, you will have to build your own opencv libs first.

berak gravatar imageberak ( 2014-07-07 01:24:47 -0500 )edit

Or just tell your codeblocks to use the VC compiler. Much easier :)

StevenPuttemans gravatar imageStevenPuttemans ( 2014-07-07 02:38:22 -0500 )edit

Hello Berak, I thankyou for your guidance, I removed C:\opencv248\opencv\build\x86\vc10\bin from all settings, still same problem.

Dear StevenPuttemans , can you tell me how to use VC compiler , I have not installed any other IDE like VS etc. This vc came with CodeBlock.

sookhen gravatar imagesookhen ( 2014-07-07 10:19:18 -0500 )edit
1

sookhen, you got 2 options now:

  1. get vs express (free, but major download) and discard codeblocks/mingw.
  2. build the opencv libs from scratch (major work)
berak gravatar imageberak ( 2014-07-07 10:31:52 -0500 )edit

Dear Berak , Thanks . I have both downloaded available with me. VS2010 and Mingw almost 1.3 GB data , Got MinGW through mingw-get-setup.exe , have cmake-3.0.0-win32-x86.exe , I also have downloaded MinGWStudioFullSetupPlus-2.exe . I have used codeblocks-10.05mingw-setup.exe to install CodeBlock. I have also tried C::B ver 12 and codeblocks-13.12mingw-setup.exe

Please guide me , which is more stable way, I want to avoid VS2010 as it will restrict the scope. I have tried to build openCV libs, but I could not learn the right way. I did learn, the point is right way ...
Happy reading.

sookhen gravatar imagesookhen ( 2014-07-07 11:54:58 -0500 )edit

Trying various options, linking libraries , setting path , etc now I am getting this error

-------------- Build: Release in brave ---------------

Linking console executable: bin\Release\brave.exe obj\Release\main.o:main.cpp:(.text$_ZN2cv3MatD1Ev[__ZN2cv3MatD1Ev]+0x4d): undefined reference to cv::fastFree(void*)' obj\Release\main.o:main.cpp:(.text$_ZN2cv3MatD1Ev[__ZN2cv3MatD1Ev]+0x57): undefined reference tocv::Mat::deallocate()' e:/mingw/bin/../lib/gcc/mingw32/4.8.1/../../../../mingw32/bin/ld.exe: obj\Release\main.o: bad reloc address 0x1a in section `.text.startup' e:/mingw/bin/../lib/gcc/mingw32/4.8.1/../../../../mingw32/bin/ld.exe: final link failed: Invalid operation collect2.exe: error: ld returned 1 exit status Process terminated with status 1 (0 minutes, 1 seconds) 2 errors

sookhen gravatar imagesookhen ( 2014-07-07 23:18:26 -0500 )edit

You are making it way to complex ... right click on your codeblocks project, build options, click drop down menu. Is there a visual compiler 2008? or a visual compiler 2010? If not, just download that one and it will work.

StevenPuttemans gravatar imageStevenPuttemans ( 2014-07-08 03:02:16 -0500 )edit
1

Thanks, I am trying to change the compiler : from Build options , and Toolchain as well. I shall inform you about the results soon. Hopefully, it will be done.

sookhen gravatar imagesookhen ( 2014-07-08 03:27:32 -0500 )edit
1

Thanks everybody. I shifted back to VS2010, I wanted to use Open Source IDE like CodeBlock, with experienced programmers guiding and supporting in problem handling. Now I have configured my VS2010 on Win7 , 64 bit , I followed the steps given at this tutorial :- http://answers.opencv.org/question/6495/visual-studio-2012-and-rtlfreeheap-error/?answer=36619#post-id-36619

To pay my gratitude to Berak and Steven Puttemans , I am posting the tutorial I for configuring VS2010 , Win 7 - 32 bit. I did not build libraries for 32 bit, I used those which came with OpenCV2.4.8 in x86 folder .

http://stackoverflow.com/questions/10860352/getting-started-with-opencv-2-4-and-mingw-on-windows-7 was helpful.

Thanks a lot.

sookhen gravatar imagesookhen ( 2014-07-08 19:27:38 -0500 )edit