我希望熟悉openCV和图像处理的人能够尽快帮助我。
我绝对是新来的openCV和VC++,这是本周第三次,我遇到了错误LNK2019。
我知道这个错误意味着包含指定函数的.lib文件没有链接到项目,并且它的合适的头文件没有被包含在代码的顶部。
但基于this web page这个时候,我搜集这cvSmooth是包括在opencv_imgproc243d.lib
的功能,所以我加入这个.LIB为Additional Dependencies
,并已写入的行错误LNK2019:在函数“void __cdecl example2_4(struct _IplImage *)”中引用了无法解析的外部符号cvSmooth
#include "opencv2\imgproc\imgproc.hpp"
在我的代码顶部,但错误
error LNK2019: unresolved external symbol cvSmooth referenced in function "void __cdecl example2_4(struct _IplImage *)"
不会改变,并保持不变。
我一直很困惑?
任何帮助,将不胜感激,如果需要,请告诉我添加代码作为编辑部分我的问题,请。
是不是和cvSmooth
属于另一个.lib文件?
基于h3now的建议,我的问题的编辑部分
我的代码如下:
#include "stdafx.h"
#include "opencv\cv.h"
#include "opencv\highgui.h"
#include "opencv2\core\core.hpp"
#include "opencv2\imgproc\imgproc.hpp"
void example2_4(IplImage* image)
{
// Create some windows to show the input
// and output images in.
//
cvNamedWindow("Example4-in",CV_WINDOW_AUTOSIZE);
cvNamedWindow("Example4-out",CV_WINDOW_AUTOSIZE);
// Create a window to show our input image
//
cvShowImage("Example4-in", image);
// Create an image to hold the smoothed output
//
IplImage* out = cvCreateImage(cvGetSize(image),IPL_DEPTH_8U,3);
// Do the smoothing
//
// Do the smoothing
//
cvSmooth(image, out, CV_GAUSSIAN, 3, 3);
// Show the smoothed image in the output window
//
cvShowImage("Example4-out", out);
// Be tidy
//
cvReleaseImage(&out);
// Wait for the user to hit a key, then clean up the windows
//
cvWaitKey(0);
cvDestroyWindow("Example4-in");
cvDestroyWindow("Example4-out");
}
int main(int argc, char* argv[])
{
IplImage* img = cvLoadImage(argv[1]);
example2_4(img);
cvReleaseImage(&img);
system("pause");
return 0;
}
例如,当我在功能上右键单击cvCreateImage
和并选择Go To Definition
打开一个名为core_c.h的文件。所以理解这个函数的原型包含在core_c.h中。
因此,对于这个原因,我们明白,我们应该写#include "opencv2\core\core.hpp"
或#include "opencv2\core\core_c.h"
(我认为使用任何两个码的没有区别)在我们的代码并链接opency_core243d.lib
顶部的项目使用的功能cvCreateImage
但是当我右键点击cvSmooth
并选择Go To Definition
时,什么也没有发生
@ h3now建议的解决方案是否适用于所有功能?
因为当我也右键单击cvShowImage时,没有任何反应。
有时候这个库包含一些其他的库。只要确保你没有错过核心库或其他。 –