Ask Your Question

Plecharts's profile - activity

2013-12-11 02:05:59 -0600 received badge  Student (source)
2013-12-10 15:59:36 -0600 received badge  Editor (source)
2013-12-10 15:57:49 -0600 asked a question Installing both MinGW and MSVC versions of OpenCV

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

  if(CMAKE_OPENCV_GCC_TARGET_MACHINE MATCHES "64")

to

  if(OPENCV_GCC_TARGET_MACHINE MATCHES "64")

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 2.4.7.2 .