我需要帮助。几个月前,我在Windows上的Visual studio中编写了这段c++代码。我从这些代码生成了.exe文件,一切都很好,就像这样。这是用于图像处理的简单代码。现在,我尝试在Linux上的Eclipse中做同样的事情,这样我就可以将可执行文件放到Linux web服务器上。但是我有这个错误:
In function `main':
main.cpp:(.text.startup+0x317): undefined reference to `cv::inpaint(cv::_InputArray const&, cv::_InputArray const&, cv::_OutputArray const&, double, int)'
collect2: ld returned 1 exit status
make: *** [inpaint] Error 1我使用的是OpencCV 2.4.1库。这是源代码:
#include "opencv2/highgui/highgui.hpp"
#include "opencv2/imgproc/imgproc.hpp"
#include "opencv2/photo/photo.hpp"
#include <iostream>
using namespace cv;
using namespace std;
Mat img, img0, maska;
int main( int argc, char** argv )
{
...
}
Mat inpainted;
inpaint(img0, img, inpainted, 2, CV_INPAINT_NS);
char imeobr[256] = "images/img-uploads/finish";
strcat( imeobr, argv[1] );
strcat( imeobr, ".jpg" );
imwrite(imeobr, inpainted);
return 0;
}我认为这是输入源的问题,因为它不是输入图像的固定名称。但是,我需要为应用程序的每个用户动态更改输入源。请帮助人们。我能做些什么?
发布于 2012-12-06 18:11:39
当您忽略链接库时,会发生未定义的引用错误:
在项目的首选项中:
C/C++ Build -> GCC C++ Linker -> Libraries是否已进入库中的libopencv_imgproc库(-l)?
更新
只是为了测试,我创建了我的程序:
#include <opencv/highgui.h>
#include <opencv/cv.h>
using namespace cv;
int main(int argc, char* argv[]) {
Mat img, img0;
Mat inpainted;
inpaint(img0, img, inpainted, 2, CV_INPAINT_NS);
}在我链接的库中:
opencv_imgproc
opencv_highgui
opencv_core一切都很好..试试看,然后告诉我!
发布于 2019-02-08 20:00:44
您需要包括:
-lopencv_photo
https://stackoverflow.com/questions/13741143
复制相似问题