Compilation OpenCV2 avec CMake et visual 2008
La version OpenCV précompilée est pour utilisation avec le compilateur Mingw. Si tu veux linker un soft compilé par visual c++, il faut recompiler OpenCV.
Voici la procédure que j'ai suivie pour y arriver (en anglais) je traduirai s'il faut :
Installation effectuée sous winXP 32bits, visual C++ 2008 express
CMake
Download and install Cmake from website (free), choose win32 installer. Choose add CMake to the PATH; http://www.cmake.org/cmake/resources/software.html
OpenCV
• Download “OpenCV-2.0.0a-win32.exe” from website (http://sourceforge.net/projects/open...pencv-win/2.0/) or from installation disk.
• Run the installation of OpenCV, choose the “Do not add to the system PATH option”. Install into “OpenCV2.0” directory (no space in directory name so not in "program file" !!!). Let “Main” and “Src” checked in component to install.
• Create subdir “vs2008” within “OpenCV2.0” directory.
• Run cmake-gui and configure path to the source code and to binaries (where you installed OpenCV and the new directory created)
• Press “Configure” button and choose “Visual Studio 9 2008”, don’t change the “use native compiler option”. Click finish and wait for configure to complete. No error should arise.
• Uncheck the “Enable openMP”. Press “Configure” again. No error should arise.
• Press “Generate”. No error should arise.
• Close C-Make gui tool.
• Double click on “OpenCV2.0\vs2008\OpenCV.sln”. Visual C++ editor should open the project.
• Check Debug mode is activated, win32 selected. Then right click on Solution OpenCV and choose “Generate”.
Last log line should be something like: “Régénération globale : 24 a réussi, 0 a échoué, 3 a été ignore”. Check that “OpenCV2.0\vs2008\bin\Debug” contains dll files to be sure everything is ok.
• Repeat process by changing Debug to Release configuration.
Si t'as des warning ou des erreurs dans Visual studio, c'est qu'il y a peut être des choses à désactiver dans le config via CMake gui. J'ai par exemple du désactiver OpenMP pour que ça passe chez moi.
Bonne chance :)