Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

How to build opencv 3.1 with CUDA 7.5 and contrib modules?

System:

  • Windows 8.1 Pro 64 bit
  • Visual Studio 2013 Professional
  • CUDA Toolkit 7.5 64 bit
  • Newest version of OpenCV master and contrib source files from the official git repo

I read just about every tutorial on the subject, but they seem to be really out of date. The newest ones I could find where posted around 2014 for OpenCV 2.4. Even after reading all that was available, resolving all the errors that CMake made, there was not a single instance that Visual Studio would build OpenCV with CUDA. Without CUDA it will go trough, but the moment I add CUDA to the mix, the build fails every time.

All the error and warning types:

  1. Warning 2 warning LNK4044: unrecognized option '/LC:/Program Files/NVIDIA GPU Computing Toolkit/CUDA/v7.5/lib/x64'; ignored C:\Users\newba_000\Documents\OpenCVSources\OpenCV_built\modules\imgproc\LINK opencv_imgproc
  2. Error 3 error LNK1104: cannot open file '....\lib\Debug\opencv_core310d.lib' C:\Users\newba_000\Documents\OpenCVSources\OpenCV_built\modules\imgproc\LINK opencv_imgproc
  3. Error 1 error MSB6006: "cmd.exe" exited with code 1. C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V120\Microsoft.CppCommon.targets 170 5 opencv_core
  4. Error 4 error MSB6006: "cmd.exe" exited with code 1. C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V120\Microsoft.CppCommon.targets 170 5 opencv_cudaarithm

CUDA works for sure. Tested it with NVIDIA sample code and with some OpenCV functions using OpenCV Nuget package.