使用vcpkg安装了OpenCV和OpenCV DNN,仍然出现链接错误

时间:2019-11-29 20:39:51

标签: c++ opencv linker dotnetnuke vcpkg

我使用vcpkg为Windows 64位安装了opencv [dnn]。这是./vcpkg list返回的

jsoncpp:x64-windows                                1.9.1            jsoncpp is an implementation of a JSON reader an...
libjpeg-turbo:x64-windows                          2.0.3            libjpeg-turbo is a JPEG image codec that uses SI...
liblzma:x64-windows                                5.2.4-2          Compression library with an API similar to that ...
libpng:x64-windows                                 1.6.37-5         libpng is a library implementing an interface fo...
libwebp:x64-windows                                1.0.2-7          Lossy compression of digital photographic images.
opencv4:x64-windows                                4.1.1-3          computer vision library
opencv4[dnn]:x64-windows                                            Enable dnn module
opencv4[jpeg]:x64-windows                                           JPEG support for opencv
opencv4[opengl]:x64-windows                                         opengl support for opencv
opencv4[png]:x64-windows                                            PNG support for opencv
opencv4[tiff]:x64-windows                                           TIFF support for opencv
opencv4[webp]:x64-windows                                           WebP support for opencv
opengl:x64-windows                                 0.0-5            Open Graphics Library (OpenGL)[3][4][5] is a cro...
protobuf:x64-windows                               3.10.0           Protocol Buffers - Google's data interchange format
tiff:x64-windows                                   4.0.10-8         A library that supports the manipulation of TIFF...
zlib:x64-windows                                   1.2.11-5         A compression library

所以我认为它肯定存在,并且Visual Studio #include <opencv2\dnn.hpp>中的代码行不会引发任何错误,但是即使输入cv::dnn::Net net;,我仍然得到namespace cv::dnn has no member 'Net'的错误知道确实如此。

然后,在使用Visual Studio 2019进行编译时,我在其他文件(例如OpenCV随附的async.hpp)中遇到了很多错误,说 Error C3646 'CV_NOEXCEPT': unknown override specifier (compiling source file src\main.cpp) ...opencv2\core\async.hpp 34,并且在以下文件中得到了更多的编译错误: >

  • dnn.hpp
  • async.hpp
  • dict.hpp
  • version.hpp
  • layer.hpp
  • dnn.inl.hpp
  • interface_engine.hpp

我相信这些都与所包含的dnn模块链接。

编辑:我也使用vcpkg安装了jsoncpp,它工作正常。

1 个答案:

答案 0 :(得分:0)

包括以下内容: #include“ opencv2 / dnn / dnn.hpp”