CMake Error: The following variables are used in this project, but they are set to NOTFOUND.

CMake Error: The following variables are used in this project, but they are set to NOTFOUND.错误引发的深思:


关于opencv2.4.13.2在cmake(3.9.6版本)编译为( vs IDE 32位架构下支持的)opencv_gpu包,
过程中,选择 Visual Studio 14 2015(注意与Visual Studio 14 2015 Win64区别)
我的cuda版本:win10 8.0 x86_64支持。
出现CMake Error: The following variables are used in this project, but they are set to NOTFOUND.的问题!!!

缺少库:

opencv_dep_CUDA_cufft_LIBRARY

opencv_dep_CUDA_nppc_LIBRARY

opencv_dep_CUDA_nppi_LIBRARY

opencv_dep_CUDA_npps_LIBRARY 

参考链接:https://stackoverflow.com/questions/33097558/cmake-cuda-libraries-not-found-when-compiling-opencv

Thanks to tips from Drop in the comments, I solved this problem. In order to close this question, I'm answering my own question.

It's a "Win32 or x64" architecture problem. Since NVIDIA only provides cufftnvblasnppcnppinpps libs for x64, it's naturally impossible for CMAKE to find these libs for configuring a Win32 OpenCV library.

My solution was to choose Visual Studio 11 Win64 instead of Visual Studio 11 as generator in CMAKE. So that CMAKE will automatically load libs from <CUDA_DIR>\lib\x64 rather than <CUDA_DIR>\lib\Win32. Further more, I also need to load all the other libs required by OpenCV in 64 bit version, such as OpenGL. I will also need to compile OpenCV in x64 architecture. All the code I'm going to write in the future will have to build and debug in x64 only.

Notes:Nvidia 不提供x64的库 cufft、nvblas、nppc、nppi、npps.



原VS Debug-x64架构下的opencv2.4.13.2(gpu支持)

1 VC++目录--包含目录:
E:\opencv2.4.13\cuda_vc14\ install\include
E:\opencv2.4.13\cuda_vc14\ install\include\opencv
E:\opencv2.4.13\cuda_vc14\ install\include\opencv2

2 VC++目录--库目录:
E:\opencv2.4.13\cuda_vc14\ install\x64\vc14\lib
C:\Program Files\ NVIDIA GPU Computing Toolkit\CUDA\v8.0\lib\x64

3 系统变量
  E:\opencv2.4.13\cuda_vc14\ install\x64\vc14\bin
note:配置完系统变量,重启(重启vs或windows)才能生效!!!

4 链接器--输入--附加依赖项:
opencv_ml2413d.lib
opencv_calib3d2413d.lib
opencv_contrib2413d.lib
opencv_core2413d.lib
opencv_features2d2413d.lib
opencv_flann2413d.lib
opencv_gpu2413d.lib
opencv_highgui2413d.lib
opencv_imgproc2413d.lib
opencv_legacy2413d.lib
opencv_objdetect2413d.lib
opencv_ts2413d.lib
opencv_video2413d.lib
opencv_nonfree2413d.lib
opencv_ocl2413d.lib
opencv_photo2413d.lib
opencv_stitching2413d.lib
opencv_superres2413d.lib
opencv_videostab2413d.lib

发布了81 篇原创文章 · 获赞 118 · 访问量 24万+

猜你喜欢

转载自blog.csdn.net/dlphay/article/details/79502918