Visual c++ 错误 ;3 ;错误LNK2019:未解析的外部符号;public:class cv::Mat“thiscall ft”数据::获取“图像(int,int)”信息;
我正在使用创建一个人脸识别程序,但我有一些错误,我不知道如何解决它Visual c++ 错误 ;3 ;错误LNK2019:未解析的外部符号;public:class cv::Mat“thiscall ft”数据::获取“图像(int,int)”信息;,visual-c++,opengl,opencv,visual-studio-2012,Visual C++,Opengl,Opencv,Visual Studio 2012,我正在使用创建一个人脸识别程序,但我有一些错误,我不知道如何解决它 Mat im = data.get_image(i,0); if(im.empty())continue; //Unresolved external symbol vector<Point2f> p = data.get_points(i,false); int n = p.size(); //Unresolved external symbol Mat im=data.get_image(i,0);如果(im.
Mat im = data.get_image(i,0); if(im.empty())continue; //Unresolved external symbol
vector<Point2f> p = data.get_points(i,false); int n = p.size(); //Unresolved external symbol
Mat im=data.get_image(i,0);如果(im.empty())继续//未解析外部符号
向量p=数据。获取_点(i,false);int n=p.size()//未解析外部符号
这就是我得到的错误
Error 3 error LNK2019: unresolved external symbol "public: class cv::Mat __thiscall ft_data::get_image(int,int)" (?get_image@ft_data@@QAE?AVMat@cv@@HH@Z) referenced in function "public: void __thiscall face_detector::train(class ft_data &,class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >,class cv::Mat const &,bool,bool,float,float,int,class cv::Size_<int>)" (?train@face_detector@@QAEXAAVft_data@@V?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@ABVMat@cv@@_N3MMHV?$Size_@H@6@@Z) D:\Workshop\Final\C++ Console Application\AAM-Raw\AAM-Raw\AAM-Raw.obj AAM-Raw
Error 4 error LNK2019: unresolved external symbol "public: class std::vector<class cv::Point_<float>,class std::allocator<class cv::Point_<float> > > __thiscall ft_data::get_points(int,bool)" (?get_points@ft_data@@QAE?AV?$vector@V?$Point_@M@cv@@V?$allocator@V?$Point_@M@cv@@@std@@@std@@H_N@Z) referenced in function "public: void __thiscall face_detector::train(class ft_data &,class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >,class cv::Mat const &,bool,bool,float,float,int,class cv::Size_<int>)" (?train@face_detector@@QAEXAAVft_data@@V?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@ABVMat@cv@@_N3MMHV?$Size_@H@6@@Z) D:\Workshop\Final\C++ Console Application\AAM-Raw\AAM-Raw\AAM-Raw.obj AAM-Raw
错误3错误LNK2019:未解析的外部符号“public:class cv::Mat _uthiscall ft_data::get_image(int,int)”(?get_image@ft_data@@QAE?AVMat@cv@@HH@Z)在函数“public:void\uuu thiscall face\u detector::train(类ft\u数据和,类std::基本字符串,类cv::Mat const&,bool,bool,float,float,int,类cv::Size\uu”中引用(?train@face_detector@@Qaexavft_数据@@V?$basic_string@DU?$char_traits@D@性病病毒$allocator@D@2@@std@@ABVMat@cv@@_N3MMHV?$尺寸_@H@6@@Z) D:\Workshop\Final\C++控制台应用程序\AAM Raw\AAM Raw\AAM-Raw.obj AAM Raw
错误4错误LNK2019:未解析的外部符号“public:class std::vector _thiscall ft_data::get_points(int,bool)”(?get_points@ft_data@@QAE?AV$vector@V?$Point_@M@cv@@V$allocator@V?$Point_@M@cv@@@std@@@std@@H_N@Z)在函数“public:void\u thiscall face\u detector::train”中引用(类ft_数据和,类std::基本_字符串,类cv::材料常数和,布尔,布尔,浮点,浮点,整型,类cv::大小)?train@face_detector@@Qaexavft_数据@@V?$basic_string@DU?$char_traits@D@性病病毒$allocator@D@2@@std@@ABVMat@cv@@_N3MMHV?$尺寸_@H@6@@Z) D:\Workshop\Final\C++控制台应用程序\AAM Raw\AAM Raw\AAM-Raw.obj AAM Raw
在我放入#include
之前,它不会显示错误,我需要该标题来声明一个variabel
我使用Visual Studio 2012和C++控制台应用程序 你的问题可能是其中任何一个问题。请仔细寻找相关问题并着手解决。我没有你的完整代码,这就是为什么我不能确定哪一个是问题的原因。 我猜您的问题是因为源代码中的
train
函数而出现的。我希望您在该代码段中查找以下问题。很可能您有全局常量问题,但也可能缺少函数体或变量
全局常数:
C++全局常量具有静态链接。这与C不同。如果
您尝试使用C++中的全局常量在多个文件中获得一个
未解决的外部错误。编译器优化全局常量
输出,不为变量保留任何空间。一种解决方法
此错误是将常量初始化包含在头文件中
并在必要时将该标头包含在CPP文件中,就像
这是函数原型。另一种可能性是使变量
非常量,并在评估时使用常量参考
缺少函数体或变量
只需一个函数原型,编译器就可以继续运行,而无需
错误,但链接器无法解析对地址的调用,因为
没有保留函数代码或变量空间。您将看不到
此错误将一直持续到创建对链接器调用的函数的调用为止
必须解决
自动(功能范围)变量
函数中声明的变量只能在
该职能的范围
函数内联问题
如果使用函数内联,则必须:
- 在包含的头文件中实现内联函数
- 在头文件中启用内联
如果您使用的是64位版本的OpenCV库,或者使用64位配置编译的OpenCV,请不要忘记将video studio项目切换到64位
在32位项目中尝试使用64位库时,Visual Studio会给出未解决的外部错误,这非常令人困惑,因为您将包含正确的库。至少按名称列出。此快速谷歌搜索可能会有所帮助:抱歉,但我读过后仍然没有得到它,您能给我举个例子吗?谢谢