我正在尝试编译一个简单的opencv程序。我已经设置了环境变量,并且还设置了c ++附加项目的目录dir 额外的链接器目录和输入依赖项(opencv_ts300d.lib和opencv_world300d.lib),但我不断收到此代码的链接器错误:
#include<iostream>
#include<opencv2\opencv.hpp>
#include<cstdio>
#include <string>
#include <opencv2\core\core.hpp>
#include <opencv2\imgcodecs.hpp>
#include <opencv2\highgui\highgui.hpp>
using namespace std;
using namespace cv;
int main(int argc, char** argv)
{
cv::Mat a;
return 0;
}
错误如下:
翻译:
错误1错误LNK2019:未解析的外部符号“void __cdecl&gt; cv :: fastFree(void *)”(?fastFree @ cv @@ YAXPAX @ Z)在函数“public:&gt; __ thiscall cv :: Mat中引用: :~Mat(void)“(?? 1Mat @ cv @@ QAE @ XZ)C:\ Users \ Sergio \ documents \ visual studio 2013 \ Projects \ opencvtest \ opencvtest \ Origine.obj opencvtest
错误2错误LNK2019:未解析的外部符号“public:void&gt; __ thiscall cv :: Mat :: deallocate(void)”(?deallocate @ Mat @ cv @@ QAEXXZ)在函数“public:void __thiscall”中引用&gt; cv :: Mat :: release(void)“(?&gt; release @ Mat @ cv @@ QAEXXZ)C:\ Users \ Sergio \ documents \ visual studio 2013 \ Projects \ opencvtest \ opencvtest \ Origine.obj opencvtest
原文:
Errore 1错误LNK2019:riferimento al simbolo esterno“void __cdecl cv :: fastFree(void *)“(?fastFree @ cv @@ YAXPAX @ Z)non risolto nella funzione“public:__ thiscall cv :: Mat :: ~Mat(void)” (?? 1Mat @ cv @@ QAE @ XZ)C:\ Users \ Sergio \ documents \ visual studio 2013 \ Projects \ opencvtest \ opencvtest \ Origine.obj opencvtest
Errore 2错误LNK2019:riferimento al simbolo esterno“public:void __thiscall cv :: Mat :: deallocate(void)“(?deallocate @ Mat @ cv @@ QAEXXZ)non risolto nella funzione”public:void __thiscall CV ::垫::释放(无效)” (?发布@ Mat @ cv @@ QAEXXZ)C:\ Users \ Sergio \ documents \ visual studio 2013 \ Projects \ opencvtest \ opencvtest \ Origine.obj opencvtest
答案 0 :(得分:1)
当我遇到这种情况时,我正在链接到OpenCV库的x64版本,但是尝试编译成x86(Win32)应用程序。只是改变了32 bit to 64 bit application制作的矿井工作。
答案 1 :(得分:-1)
尝试
#include <"highgui.hpp">
我不是在我的工作电脑上检查我的来源,但我相信它是这样的。