You are here:Home » image processing » Linking OpenCV 2 library in DEVC++

Linking OpenCV 2 library in DEVC++

In my earlier post I have discussed how to link OpenCV 1.x with devC++. But with latest release of OpenCV version ie. OpenCV 2 or higher the earlier method will not work. This because, OpenCV have changed the directory structure. So lets learn how to link OpenCV 2 or higher library version in DevC++ IDE.

  • Goto Tools -> Compiler option 
  • In the pop up click on the plus button. This means you are adding new compiler setting. Add your fav. name eg - OpenCV2
  • Now you need to add compiler commands. Add -L"C:\OpenCV2.X\lib" -lcxcore2X0 -lcv2X0 -lcvaux2X0 -lhighgui2X0 -lml2X0  where X stands for version. Eg For open CV 2.0 add --L"C:\OpenCV2.0\lib" -lcxcore200 -lcv200 -lcvaux200 -lhighgui200 -lml200 . Similarly for OpenCV2.1 add -L"C:\OpenCV2.1\lib" -lcxcore210 -lcv210 -lcvaux210 -lhighgui210 -lml210
  • Add linker command similarly as above. -lcxcore2X0 -lcv2X0 -lcvaux2X0 -lhighgui2X0 -lml2X0 For open CV 2.0 add --L"C:\OpenCV2.0\lib" -lcxcore200 -lcv200 -lcvaux200 -lhighgui200 -lml200 . Similarly for OpenCV2.1 add -L"C:\OpenCV2.1\lib" -lcxcore210 -lcv210 -lcvaux210 -lhighgui210 -lml210
  • Goto Directories -> C includes. Add  C:\OpenCV2.0\include or C:\OpenCV2.1\include or C:\OpenCV2.2\include what ever version you have. I assume that you have installed openCV in C:\
  •  Goto Directories -> Library. Add  C:\OpenCV2.0\lib or C:\OpenCV2.1\libor C:\OpenCV2.2\lib what ever version you have.
  • Goto Directories -> Library. Add  C:\OpenCV2.0\bin or C:\OpenCV2.1\bin or C:\OpenCV2.2\bin what ever version you have. 
  • Now lets write a sample project for OpenCV. Open New project window  and select "Console Application".
  • Non in Project Option > Compiler chose "OpenCV2".
Thus you have successfully integrated OpenCV with DevC++.

0 comments:

Post a Comment