具有Qt加载项的Visual Studio链接到OpenCV

静脉

我尝试将OpenCV库集成到我在Visual Studio 2012中基于Qt的项目中。我知道还有很多其他线程可以解决此问题,但没有一个解决了我的链接问题。这是我的设置:

  • Windiws 8.1 64位
  • Visual Studio 2012 32位
  • OpenCV 3.0
  • Qt 5.1 32位和Qt插件1.2.3

我下载了OpenCV 3.0 Windows软件包,并使用CMake和Visual Studio编译器进行了构建。我遵循了这条指令构建文件夹如下所示:在的.lib和.dll文件被正确地产生:然后我跟着官方的OpenCV上的说明页面,这一个,做了以下配置: enter image description here

  • VC ++目录‣“可执行目录”:我将路径添加到了bin文件夹中,如图3所示。
  • VC ++目录‣“库目录”:我将路径添加到第二张图片所示lib文件夹中
  • C/C++ ‣ General ‣ "Additional Include Directories": here I added the path to the original include folder of the extracted OpenCV package as the build includes folder is empty
  • Linker ‣ General ‣ "Additional Library Directories": here I added the path to the lib files
  • Linker ‣ Input ‣ "Additional Dependencies": here I listed all libraries like this:
    opencv_core300d.lib
    opencv_highgui300d.lib
    opencv_imgproc300d.lib
    opencv_video300d.lib
    opencv_calib3d300d.lib
    opencv_contrib300d.lib
    opencv_features2d300dd.lib
    opencv_flann300d.lib
    opencv_gpu249d.lib
    opencv_legacy300d.lib
    opencv_ml300d.lib
    opencv_nonfree300d.lib
    opencv_objdetect300dd.lib
    opencv_ocl300d.lib
    opencv_photo249d.lib
    opencv_stitching300d.lib
    opencv_superres300d.lib
    opencv_ts300d.lib
    opencv_videostab300d.lib

I also want to note that I can not change the code generation to /MTd as Qt would not work with that (but that should not be the problem since I build OpenCV activating the option WITH_QT in the CMake configuration)

Additionally I put all .dll files in the same directory as my generated debug .exe (Visual Studio otherwise complained that the .dll could not be found)

When I try to execute a function of the OpenCV lib or only create an object I always get unsolved link errors like this one:

Fehler 2 error LNK2019: Verweis auf nicht aufgelöstes externes Symbol ""class cv::Mat __cdecl cv::imread(class cv::String const &,int)" (?imread@cv@@YA?AVMat@1@ABVString@1@H@Z)" in Funktion "_main".

or this one

Fehler 2 error LNK2019: Verweis auf nicht aufgelöstes externes Symbol ""public: __thiscall cv::VideoCapture::VideoCapture(void)" (??0VideoCapture@cv@@QAE@XZ)" in Funktion ""void __cdecl loadMovie(class QString)" (?loadMovie@@YAXVQString@@@Z)".

I really would appreciate the help since I have been struggling for one whole week now trying everything I found on the internet.

Micka

The problem is, that the provided link How to build applications with OpenCV inside the Microsoft Visual Studio is for OpenCV 2.4.11 where libraries were managed a little bit different.

From OpenCV 3.0 on, opencv_highgui lib is split to different sub-libraries concerning VideoCapture, image reading and other stuff. As you can see in your screenshot, there are other libs, which you didn't add yet to your project, e.g. opencv_imgcodecs300d.lib and opencv_videoio300d.lib

Try to add all those libraries. If that works, and if you want to reduce dependencies, you can remove libraries until linker fails.

本文收集自互联网,转载请注明来源。

如有侵权,请联系[email protected] 删除。

编辑于
0

我来说两句

0条评论
登录后参与评论

相关文章

来自分类Dev

如何让 Microsoft Visual Studio 2017 链接到 OpenCV 3.4 库?

来自分类Dev

如何将opencv和其他dll文件链接到Visual Studio 2013的输出exe

来自分类Dev

如何将opencv和其他dll文件链接到Visual Studio 2013的输出exe

来自分类Dev

无法安装Qt 5 Visual Studio加载项

来自分类Dev

Qt Visual Studio 2015加载项编译问题

来自分类Dev

无法安装Qt 5 Visual Studio加载项

来自分类Dev

为什么在带有Qt加载项的Visual Studio Qt项目中添加自定义生成步骤会停止自动MOC和UIC步骤?

来自分类Dev

Qt Visual Studio加载项是否支持Visual Studio 2013社区版?

来自分类Dev

将Xamarin iOS UI项目链接到Visual Studio项目

来自分类Dev

Microsoft Visual Studio CSS验证错误链接到错误的文件

来自分类Dev

Visual Studio 2015链接到MFC42

来自分类Dev

Excel更改链接到加载项

来自分类Dev

Qt-Visual Studio 2013加载项不会编译项目

来自分类Dev

Qt5 Visual Studio 2012加载项不允许调试到QStack / QVector中

来自分类Dev

使用 Visual Studio 项目使 Opencv 可移植并消除链接错误

来自分类Dev

Qt VS加载项-链接外部库

来自分类Dev

Qt VS加载项-链接外部库

来自分类Dev

在Visual Studio Online中,拉取请求可以链接到工作项。有没有一种基于此的查询方式?

来自分类Dev

XLL是Platform Toolset Visual Studio 2019的“不是有效的加载项”编译

来自分类Dev

带有Visual Studio 2013的Outlook加载项不起作用

来自分类Dev

在Visual Studio中无需增强即可将ASIO链接到项目

来自分类Dev

使用Visual Studio链接到第三方库

来自分类Dev

Visual Studio(C ++)自动链接到不需要版本的lib文件

来自分类Dev

链接到SFML的未解决的外部错误(SFML 2.2,Visual Studio Community 2013)

来自分类Dev

使用cmake生成Visual Studio sln项目,而无需链接到原始CMakeFiles.txt

来自分类Dev

Visual Studio C编译器未将头文件链接到其源副本

来自分类Dev

尝试链接到MTM时Visual Studio关联的自动化未显示测试

来自分类Dev

VBA:将 Visual Studio 代码链接到 Excel 输入单元格和输出表

来自分类Dev

CMake:将不同的OpenCV库链接到同一项目的不同可执行文件

Related 相关文章

  1. 1

    如何让 Microsoft Visual Studio 2017 链接到 OpenCV 3.4 库?

  2. 2

    如何将opencv和其他dll文件链接到Visual Studio 2013的输出exe

  3. 3

    如何将opencv和其他dll文件链接到Visual Studio 2013的输出exe

  4. 4

    无法安装Qt 5 Visual Studio加载项

  5. 5

    Qt Visual Studio 2015加载项编译问题

  6. 6

    无法安装Qt 5 Visual Studio加载项

  7. 7

    为什么在带有Qt加载项的Visual Studio Qt项目中添加自定义生成步骤会停止自动MOC和UIC步骤?

  8. 8

    Qt Visual Studio加载项是否支持Visual Studio 2013社区版?

  9. 9

    将Xamarin iOS UI项目链接到Visual Studio项目

  10. 10

    Microsoft Visual Studio CSS验证错误链接到错误的文件

  11. 11

    Visual Studio 2015链接到MFC42

  12. 12

    Excel更改链接到加载项

  13. 13

    Qt-Visual Studio 2013加载项不会编译项目

  14. 14

    Qt5 Visual Studio 2012加载项不允许调试到QStack / QVector中

  15. 15

    使用 Visual Studio 项目使 Opencv 可移植并消除链接错误

  16. 16

    Qt VS加载项-链接外部库

  17. 17

    Qt VS加载项-链接外部库

  18. 18

    在Visual Studio Online中,拉取请求可以链接到工作项。有没有一种基于此的查询方式?

  19. 19

    XLL是Platform Toolset Visual Studio 2019的“不是有效的加载项”编译

  20. 20

    带有Visual Studio 2013的Outlook加载项不起作用

  21. 21

    在Visual Studio中无需增强即可将ASIO链接到项目

  22. 22

    使用Visual Studio链接到第三方库

  23. 23

    Visual Studio(C ++)自动链接到不需要版本的lib文件

  24. 24

    链接到SFML的未解决的外部错误(SFML 2.2,Visual Studio Community 2013)

  25. 25

    使用cmake生成Visual Studio sln项目,而无需链接到原始CMakeFiles.txt

  26. 26

    Visual Studio C编译器未将头文件链接到其源副本

  27. 27

    尝试链接到MTM时Visual Studio关联的自动化未显示测试

  28. 28

    VBA:将 Visual Studio 代码链接到 Excel 输入单元格和输出表

  29. 29

    CMake:将不同的OpenCV库链接到同一项目的不同可执行文件

热门标签

归档