To use OpenCV with CodeBlocks, you need to tell CodeBlocks:
- The directory which contains the OpenCV header files →
c:opencvuildinclude
- List of OpenCV libraries needed for linking →
c:opencvuildx86mingwlibslibopencv_*.dll.a
1. Add the OpenCV header files directory
Open Settings → Compiler and debugger... → Search directories tab → Compiler tab
Click add button for adding a new entry. In the popup dialog, type c:opencvuildinclude
,
and click Ok.
2. Add the OpenCV libraries needed for linking
Open Settings → Compiler 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:opencvuildx86mingwlib
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.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…