c++ - 实例化 Mat 对象时 opencv 3.0.0 链接器错误

标签 c++ opencv visual-studio-2013 linker-errors

我正在尝试编译一个简单的 opencv 程序。我已经设置了环境变量,还设置了项目的 C++ 附加包含目录以及 额外的链接器目录和输入依赖项(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;
}

错误如下:

翻译:

Error 1 error LNK2019: unresolved external symbol "void __cdecl >cv::fastFree(void *)" (?fastFree@cv@@YAXPAX@Z) referenced in function "public: >__thiscall cv::Mat::~Mat(void)" (??1Mat@cv@@QAE@XZ) C:\Users\Sergio\documents\visual studio 2013\Projects\opencvtest\opencvtest\Origine.obj opencvtest

Error 2 error LNK2019: unresolved external symbol "public: void >__thiscall cv::Mat::deallocate(void)" (?deallocate@Mat@cv@@QAEXXZ) referenced >in function "public: void __thiscall cv::Mat::release(void)" (?>release@Mat@cv@@QAEXXZ) C:\Users\Sergio\documents\visual studio 2013\Projects\opencvtest\opencvtest\Origine.obj opencvtest

原文:

Errore 1 error 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 error 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::release(void)" (?release@Mat@cv@@QAEXXZ) C:\Users\Sergio\documents\visual studio 2013\Projects\opencvtest\opencvtest\Origine.obj opencvtest

最佳答案

当我遇到这种情况时,我正在链接到 OpenCV 库的 x64 版本,但试图编译成 x86 (Win32) 应用程序。只是从 32 bit to 64 bit application 改变让我的工作成功。

关于c++ - 实例化 Mat 对象时 opencv 3.0.0 链接器错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30831488/

相关文章:

c++ - 编译器看不到在类内部定义的友元函数

python - 如何将图像的像素值复制到另一个python变量以使该python变量将图像保存在opencv中

asp.net - 如何使用 Entity Framework 代码优先更新数据库结构而不丢失所有数据?

google-chrome - Chrome 显示空白的 TypeScript 文件

visual-studio-2013 - 如何扩展 Visual Studio Web 发布管道?

c++ - 如果用户到达 else (C++),则返回到 "cin"的开头

c++ - C++中的插入器和提取器函数

c++ - 在预期非成员函数指针时传递成员函数指针?

macos - 在 Mac 上构建 openCV 3.0.0 时出错

python - 如何安装 libavformat.so.56 和 libavformat.so.57?