且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何使用OpenCV 2.4.3与Code :: Blocks编译程序?

更新时间:1970-01-01 07:58:18

To use OpenCV with CodeBlocks, you need to tell CodeBlocks:

  1. The directory which contains the OpenCV header files → c:\opencv\build\include
  2. List of OpenCV libraries needed for linking → c:\opencv\build\x86\mingw\libs\libopencv_*.dll.a


1. Add the OpenCV header files directory

Open SettingsCompiler and debugger...Search directories tab → Compiler tab

Click add button for adding a new entry. In the popup dialog, type c:\opencv\build\include,

and click Ok.


2. Add the OpenCV libraries needed for linking

Open SettingsCompiler and debugger... → Linker settings tab.

Click add for adding new entries and open a popup dialog.

Click the "..." button to open the File Open Dialog. Go to c:\opencv\build\x86\mingw\lib directory and select all files by pressing Ctrl-A.

Click Open to add the files,

Click Ok to save all settings.


Now that you've set the include directory and the libraries for linking, you can compile and run your project by pressing F9 key.