Installing both MinGW and MSVC versions of OpenCV

asked 2013-12-10 15:57:49 -0500

Plecharts gravatar image

updated 2013-12-10 16:15:24 -0500

Hi, I have been trying to install two versions of OpenCV simultaneously. All versions of OpenCV compile and install correctly, but the problem arises when I try to compile my program and link it with OpenCV.

When I compile and install the MSVC version last, I can compile my program succesfully with MSVC, but not with G++, since G++ will complain about not being able to find the right functions. When I compile MinGW version last, my program compiles right using G++, but not using MSVC.

It seems I am able to solve this issue by modifying the OpenCVConfig.cmake file in the install/ folder and replacing line 89 from




After doing this change CMake will automatically switch between the two versions depending on the compiler, but I always have to change the OpenCV_CONFIG_PATH and OPENCV_DIR variables in cmake-gui to point to the install/ folder instead of the OpenCV root folder.

My question is: Is there a way to not have to do this workaround on every machine where I want to compile my code or is this necessary?

I am running Windows 7 64-bit, Visual Studio 2013 64-bit, G++ 4.8.2, latest CMake nightly build and OpenCV .

edit retag flag offensive close merge delete