gpt4 book ai didi

c++ - OpenCV 程序无法在 Visual Studio 2010 上编译

转载 作者:行者123 更新时间:2023-11-28 06:44:10 33 4
gpt4 key购买 nike

我正在尝试在 Visual Studio 2010 中编译一个非常简单的 OpenCV (2.4.9) 程序,只是为了检查 opencv 库是否已正确链接。这是我要运行的程序代码。

#include "stdafx.h"
#include <stdio.h>
#include <opencv2/opencv.hpp>

using namespace cv;

int main(int argc, char** argv )
{
Mat image;
image = imread( "MyPic.jpg", 1 );

if ( !image.data )
{
printf("No image data \n");
return -1;
}
namedWindow("Display Image", CV_WINDOW_AUTOSIZE );
imshow("Display Image", image);

waitKey(0);

return 0;
}

但是当我按下构建按钮时,编译失败并显示以下错误。

1>LINK : fatal error LNK1104: cannot open file 'opencv_gpu249.lib'

可能是什么问题?如何解决?

enter image description here

最佳答案

您需要将 OpenCV 库路径添加到 Visual Studio 的库目录:

OpenCV-2.4.9-Path\build\x86\vc10\lib

或 64 位

OpenCV-2.4.9-Path\build\x64\vc10\lib

关于c++ - OpenCV 程序无法在 Visual Studio 2010 上编译,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25340150/

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