Windows 7上的OpenCV 3.10安装问题

时间:2018-07-30 23:43:49

标签: c++ opencv cmake

我完全是Cmake的入门者,我不知道该把代码放在哪里。我的问题是:

CMake Deprecation Warning at CMakeLists.txt:81 (cmake_policy):
  The OLD behavior for policy CMP0020 will be removed from a future version
  of CMake.

  The cmake-policies(7) manual explains that the OLD behaviors of all
  policies are deprecated and that a policy should be set to OLD only under
  specific short-term circumstances.  Projects should be ported to the NEW
  behavior and not rely on setting a policy to OLD.

我正在按照https://www.learnopencv.com/install-opencv3-on-windows/

上的说明进行操作

并在这里找到答案

http://answers.opencv.org/question/165060/opencv-32-install-problems-in-windows10-64-bit-vs2017/

我需要在Cmake文件中添加行,但我不知道将其添加到何处。

cmake -DENABLE_PRECOMPILED_HEADERS=OFF

如果我在此处添加https://imgur.com/a/QdO7ucX,则会显示错误:CMake错误

CMakeLists.txt:12:
Parse error. Expected a command name, got left paren with text "(".

这是我的cmake文件:

https://drive.google.com/open?id=1rhT_Sl2XH-ejI_tDBfSIbl2304huDq3n

使用Visual Studio 2013,OpenCV 3.10 Cmake 3.12

有人可以帮助我吗?

编辑:

1>------ Build started: Project: ConsoleApplication14, Configuration: Release x64 ------
1>Source.obj : error LNK2001: unresolved external symbol "public: virtual double __cdecl cv::VideoCapture::get(int)const " (?get@VideoCapture@cv@@UEBANH@Z)
1>Source.obj : error LNK2001: unresolved external symbol "public: virtual bool __cdecl cv::VideoCapture::isOpened(void)const " (?isOpened@VideoCapture@cv@@UEBA_NXZ)
1>Source.obj : error LNK2001: unresolved external symbol "public: virtual __cdecl cv::VideoCapture::~VideoCapture(void)" (??1VideoCapture@cv@@UEAA@XZ)
1>Source.obj : error LNK2001: unresolved external symbol "public: __cdecl cv::VideoCapture::VideoCapture(int)" (??0VideoCapture@cv@@QEAA@H@Z)
1>Source.obj : error LNK2001: unresolved external symbol "public: virtual void __cdecl cv::VideoWriter::write(class cv::Mat const &)" (?write@VideoWriter@cv@@UEAAXAEBVMat@2@@Z)
1>Source.obj : error LNK2001: unresolved external symbol "public: virtual __cdecl cv::VideoWriter::~VideoWriter(void)" (??1VideoWriter@cv@@UEAA@XZ)
1>Source.obj : error LNK2001: unresolved external symbol "public: __cdecl cv::VideoWriter::VideoWriter(class cv::String const &,int,double,class cv::Size_<int>,bool)" (??0VideoWriter@cv@@QEAA@AEBVString@1@HNV?$Size_@H@1@_N@Z)
1>c:\users\vartotojas\documents\visual studio 2013\Projects\ConsoleApplication14\x64\Release\ConsoleApplication14.exe : fatal error LNK1120: 7 unresolved externals
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========

opencv_videoio300.lib错误:

1>------ Build started: Project: ConsoleApplication14, Configuration: Release x64 ------
1>  Source.cpp
1>Source.cpp(15): warning C4244: 'initializing' : conversion from 'double' to 'int', possible loss of data
1>Source.cpp(16): warning C4244: 'initializing' : conversion from 'double' to 'int', possible loss of data
1>opencv_videoio300.lib(cap_vfw.obj) : error LNK2001: unresolved external symbol ICOpen
1>opencv_videoio300.lib(cap_vfw.obj) : error LNK2001: unresolved external symbol ICClose
1>opencv_videoio300.lib(cap_vfw.obj) : error LNK2001: unresolved external symbol ICSendMessage
1>opencv_videoio300.lib(cap_vfw.obj) : error LNK2001: unresolved external symbol ICDecompress
1>opencv_videoio300.lib(cap_vfw.obj) : error LNK2001: unresolved external symbol AVIFileInit
1>opencv_videoio300.lib(cap_vfw.obj) : error LNK2001: unresolved external symbol AVIFileRelease
1>opencv_videoio300.lib(cap_vfw.obj) : error LNK2001: unresolved external symbol AVIFileOpenA
1>opencv_videoio300.lib(cap_vfw.obj) : error LNK2001: unresolved external symbol AVIFileGetStream
1>opencv_videoio300.lib(cap_vfw.obj) : error LNK2001: unresolved external symbol AVIFileCreateStreamA
1>opencv_videoio300.lib(cap_vfw.obj) : error LNK2001: unresolved external symbol AVIStreamRelease
1>opencv_videoio300.lib(cap_vfw.obj) : error LNK2001: unresolved external symbol AVIStreamInfoA
1>opencv_videoio300.lib(cap_vfw.obj) : error LNK2001: unresolved external symbol AVIStreamSetFormat
1>opencv_videoio300.lib(cap_vfw.obj) : error LNK2001: unresolved external symbol AVIStreamWrite
1>opencv_videoio300.lib(cap_vfw.obj) : error LNK2001: unresolved external symbol AVIStreamGetFrameOpen
1>opencv_videoio300.lib(cap_vfw.obj) : error LNK2001: unresolved external symbol AVIStreamGetFrame
1>opencv_videoio300.lib(cap_vfw.obj) : error LNK2001: unresolved external symbol AVIStreamGetFrameClose
1>opencv_videoio300.lib(cap_vfw.obj) : error LNK2001: unresolved external symbol AVIMakeCompressedStream
1>opencv_videoio300.lib(cap_vfw.obj) : error LNK2001: unresolved external symbol AVISaveOptions
1>opencv_videoio300.lib(cap_vfw.obj) : error LNK2001: unresolved external symbol capCreateCaptureWindowA
1>opencv_videoio300.lib(cap_vfw.obj) : error LNK2001: unresolved external symbol capGetDriverDescriptionA
1>c:\users\vartotojas\documents\visual studio 2013\Projects\ConsoleApplication14\x64\Release\ConsoleApplication14.exe : fatal error LNK1120: 20 unresolved externals
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========

0 个答案:

没有答案