gpt4 book ai didi

opencv - 错误 LNK2019 : unresolved external symbol _ Open CV program

转载 作者:行者123 更新时间:2023-12-02 16:56:23 26 4
gpt4 key购买 nike

我正在学习开放式简历,同样我尝试了一些程序。
我指的是这个链接。
http://docs.opencv.org/modules/contrib/doc/facerec/tutorial/facerec_gender_classification.html

我正在使用 Visual Studio 10 来运行相同的程序,并且我认为某处我搞砸了一些配置。
我在更多程序中面临同样的问题(从同一来源挑选),

我得到的错误如下: -

1>main.obj : error LNK2019: unresolved external symbol "int __cdecl cv::waitKey(int)" (?waitKey@cv@@YAHH@Z) referenced in function __catch$_main$0

1>main.obj : error LNK2019: unresolved external symbol "class cv::Mat __cdecl cv::subspaceReconstruct(class cv::_InputArray const &,class cv::_InputArray const &,class cv::_InputArray const &)" (?subspaceReconstruct@cv@@YA?AVMat@1@ABV_InputArray@1@00@Z) referenced in function __catch$_main$0



.....(更多此类 Unresolved external symbol 错误)

1>main.obj : error LNK2001: unresolved external symbol "public: virtual bool __thiscall cv::_InputArray::empty(void)const " (?empty@_InputArray@cv@@UBE_NXZ)

1>c:\users\isenses\documents\visual studio 2010\Projects\gender_classification\Debug\gender_classification.exe : fatal error LNK1120: 37 unresolved externals

1>

1>Build FAILED.

1>Time Elapsed 00:00:00.36

========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========



我的项目属性如下:-

属性->配置属性->调试->命令参数->C:\Users\isenses\Documents\Visual Studio 2010\Projects\gender_classification\csv.txt

属性->配置属性->VC++目录->包含目录->(添加C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\lib
&
C:\openCV_2.4\opencv\build\x86\vc10\lib)

C/C++->general->additional 包含目录(添加了 openCV 的包含路径,即:-
C:\openCV_2.4\opencv\build

链接器->常规---
启用增量链接=否

其他库目录=C:\Program Files %28x86%29\Microsoft Visual Studio 10.0\VC\lib

C:\openCV_2.4\opencv\build\x86\vc10

链接器->系统---子系统=/SUBSYSTEM:CONSOLE

链接器->输入---
附加依赖=
wsock32.lib
opencv_contrib2411d.lib

opencv_calib3d2411d.lib

opencv_ml2411d.lib

opencv_objdetect2411d.lib

谢谢你。

最佳答案

感谢@miki,我能够成功构建文件。
我的问题的解决方案是:-

  • 在属性->链接器->输入中添加适当的附加依赖项。
  • 在 windows 环境变量中添加库路径。
  • 我没有使用@miki 所指出的适当的附加依赖项,正如他所引用的那样“你还必须在链接器->输入-中链接 opencv_coreXXX、opencv_highguiXXX、opencv_imgprocXXX 等......(如果在调试中,则带有尾随“d”) -- 附加依赖项”

  • 再次感谢

    关于opencv - 错误 LNK2019 : unresolved external symbol _ Open CV program,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31832569/

    26 4 0
    Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
    广告合作:1813099741@qq.com 6ren.com