• Open Source Computer Vision Library

有谁知道外部符号无法解析是怎么回事吗?

OpenCV使用问题:如函数调用,编译出错等

版主: chai2010, ollydbg23, bebekifis

有谁知道外部符号无法解析是怎么回事吗?

帖子maggie7102 » 2006-12-01 14:32

我写了好几个函数,但是编译的时候都是说外部符号无法解析是怎么回事呀?
例如: IplImage*pImage
cvNamedWindow("Graygraph",1);
cvShowImage("Graygraph",pImage);
maggie7102
OpenCV初中生
 
帖子: 28
注册: 2006-11-27 19:49

帖子Shiqi Yu » 2006-12-01 15:06

把错误贴一下
1. 发帖时请详细描述您遇到的问题,不要仅仅用“出错”,“有问题”,“不行”等没有信息含量的描述。
2. 标题中扼要描述你的问题,不要用“新手请教”之类没有信息含量的标题。
3. 不要“哭求”,“跪求”,男儿有泪不轻弹,男儿膝下有黄金。
4. 技术问题请发在板面,不要给我发送私人短信,其他问题欢迎给我发信。
头像
Shiqi Yu
站点管理员
 
帖子: 2450
注册: 2006-09-27 17:58
地址: 蛇口

帖子maggie7102 » 2006-12-01 15:41

int main()
{

IplImage*pImage=0;
int i,j;
int degreeCount[256];
int *pixelAddress=0;
int maxGraynum=0;
IplImage*Graph=0;
pImage=cvLoadImage("c:/opencv/fruits.jpg",1);
for (i=0;i<256;i++)degreeCount[i]=0;
{for(i=0;i<pImage->height;i++)
for(j=0;j<pImage->width;j++)
{* pixelAddress=((int*)(pImage>imageData+pImage>widthStep*j))[i];
degreeCount[*pixelAddress]++;
}
}

for (i=0;i<256;i++) {if (degreeCount[i]>maxGraynum)
maxGraynum=degreeCount[i];
}

Graph=cvCreateImage(cvGetSize(pImage),IPL_DEPTH_8U,1);
cvLine( Graph,cvPoint(0,0),cvPoint(255,0),CV_RGB(0,0,255),1,8);
cvLine( Graph,cvPoint(0,0),cvPoint(0,maxGraynum),CV_RGB(0,0,255),1,8);
for (i=0;i<256;i++)
cvLine( Graph,cvPoint(0+i,0),cvPoint(0+i,degreeCount[i]),CV_RGB(255,255,255),1,8);
cvNamedWindow("Graygraph",1);
cvShowImage("Graygraph",pImage);
cvWaitKey(0);
return -1;
}
:oops: :oops: 这是我写的直方图生成程序.生成之后就是这样sample1.obj : error LNK2019: 无法解析的外部符号 _cvWaitKey ,该符号在函数 _main 中被引用
sample1.obj : error LNK2019: 无法解析的外部符号 _cvShowImage ,该符号在函数 _main 中被引用
sample1.obj : error LNK2019: 无法解析的外部符号 _cvNamedWindow ,该符号在函数 _main 中被引用
sample1.obj : error LNK2019: 无法解析的外部符号 _cvLine ,该符号在函数 _main 中被引用
sample1.obj : error LNK2019: 无法解析的外部符号 _cvCreateImage ,该符号在函数 _main 中被引用
sample1.obj : error LNK2019: 无法解析的外部符号 _cvGetSize ,该符号在函数 _main 中被引用
sample1.obj : error LNK2019: 无法解析的外部符号 _cvLoadImage ,该符号在函数 _main 中被引用
maggie7102
OpenCV初中生
 
帖子: 28
注册: 2006-11-27 19:49

帖子Roland » 2006-12-01 16:29

外部库函数找不到,请检查设置的opencv函数库有没有加入链接,以及路径是否正确
头像
Roland
OpenCV本科生
 
帖子: 137
注册: 2006-10-02 4:38
地址: 德国

Re: 有谁知道外部符号无法解析是怎么回事吗?

帖子wlei » 2010-04-23 22:39

我遇到了相似的问题,如下:
正在编译资源清单...
正在链接...
cv1.obj : error LNK2019: 无法解析的外部符号 _cvShowImage,该符号在函数 _wmain 中被引用
cv1.obj : error LNK2019: 无法解析的外部符号 _cvCvtColor,该符号在函数 _wmain 中被引用
cv1.obj : error LNK2019: 无法解析的外部符号 _cvCreateImage,该符号在函数 _wmain 中被引用
cv1.obj : error LNK2019: 无法解析的外部符号 _cvQueryFrame,该符号在函数 _wmain 中被引用
cv1.obj : error LNK2019: 无法解析的外部符号 _cvCreateFileCapture,该符号在函数 _wmain 中被引用
cv1.obj : error LNK2019: 无法解析的外部符号 _cvNamedWindow,该符号在函数 _wmain 中被引用
d:\My Documents\Visual Studio 2005\Projects\cv1\Debug\cv1.exe : fatal error LNK1120: 6 个无法解析的外部命令
//求解……
wlei
OpenCV幼儿园宝宝
 
帖子: 2
注册: 2010-04-23 22:33

Re: 有谁知道外部符号无法解析是怎么回事吗?

帖子wlei » 2010-04-23 22:44

是链接库没有加的问题,好像每次新建一个项目都要加入链接库
wlei
OpenCV幼儿园宝宝
 
帖子: 2
注册: 2010-04-23 22:33

Re: 有谁知道外部符号无法解析是怎么回事吗?

帖子snowei » 2011-04-21 15:45

在项目属性的链接器(linker)输入(input)添加附加依赖项。
opencv2.2 的是:(Release)
opencv_imgproc220.lib
opencv_legacy220.lib
opencv_ml220.lib
opencv_video220.lib
opencv_highgui220.lib
opencv_core220.lib
snowei
OpenCV幼儿园宝宝
 
帖子: 1
注册: 2010-08-31 16:51

Re: 有谁知道外部符号无法解析是怎么回事吗?

帖子zelda1228 » 2011-07-29 12:28

我是用VSC++的button寫的,目的是要將視訊的畫面轉存為AVI,起初是用opencv2.0寫的,但是cvCreateVideoWriter函式一直過不了,故改用opencv2.2去編譯,過了是過了,但是卻不會轉存,只會顯示webcam的畫面

private: System::Void button8_Click(System::Object^ sender, System::EventArgs^ e) {



//frameH=(int)cvGetCaptureProperty(capture,CV_CAP_PROP_FRAME_HEIGHT);
//frameW=(int)cvGetCaptureProperty(capture,CV_CAP_PROP_FRAME_WIDTH);

//webcam程式碼存成AVI檔
CvCapture *capture;
IplImage *frame;

capture=cvCreateCameraCapture(0);
cvNamedWindow("play",0);

CvVideoWriter *writer;
/*char AviFileName[]="Output.avi";
int AviForamt = -1;
int FPS = 15;
CvSize AviSize = cvSize(640,480);
int AviColor = 1; */
//writer=cvCreateVideoWriter(AviFileName,AviForamt,FPS,AviSize,1);

writer = cvCreateVideoWriter( "Output.avi ", CV_FOURCC('F', 'L', 'V', '1'), 15 , cvSize(320,240), 1 ) ;//arg3:640*480

//cvCreateVideoWriter第二個引數 影片格式如下
//CV_FOURCC('P','I','M','1') MPEG-1 codec
//CV_FOURCC('M','J','P','G') motion-jpeg codec (does not work well)
//CV_FOURCC('M', 'P', '4', '2') MPEG-4.2 codec
//CV_FOURCC('D', 'I', 'V', '3') MPEG-4.3 codec
//CV_FOURCC('D', 'I', 'V', 'X') MPEG-4 codec
//CV_FOURCC('U', '2', '6', '3') H263 codec
//CV_FOURCC('I', '2', '6', '3') H263I codec
//CV_FOURCC('F', 'L', 'V', '1') FLV1 codec


//writer=cvCreateVideoWriter("out.avi",-1,fps,cvSize(pFrame->width, pFrame->height),isColor);cvWriteFrame(writer,pFrame1);
//int AviForamt=CV_FOURCC('P','I','M','1');

int i=0;
while(true)
{
frame = cvQueryFrame(capture);
cvWriteFrame(writer,frame);

cvShowImage("play",frame);
printf("%d\n",i);

if(cvWaitKey(20)>0) break;
i++;
}

cvReleaseCapture(&capture);
cvReleaseVideoWriter(&writer);
cvDestroyWindow("play");


//多個Webcam的程式實作
/*
CvCapture *capture0;
CvCapture *capture1;

IplImage *frame0;
IplImage *frame1;

capture0 =cvCaptureFromCAM(0);
capture1 =cvCaptureFromCAM(0);

cvNamedWindow("Webcam0",1);
cvNamedWindow("Webcam1",1);

while(true)
{
frame0 = cvQueryFrame(capture0);
frame1 = cvQueryFrame(capture1);

cvShowImage("Webcam0",frame0);
cvShowImage("Webcam1",frame1);


if(cvWaitKey(10)>=0)
{
break;
}

}

cvReleaseCapture(&capture0);
cvDestroyWindow("Webcam0");
*/


}


按了重新生成之後,就跑出以下問題了,沒有按之前都可以執行..................求救~!!!!!!!!
project setting的link有添加相应的库!!!!
opencv_core220d.lib
opencv_highgui220d.lib
opencv_video220d.lib
opencv_ml220d.lib
opencv_legacy220d.lib
opencv_imgproc220d.lib
還是不行!!!


1>OPENCV.obj : warning LNK4248: 無法解析的 typeref 語彙基元 (01000028) (對 'CvVideoWriter' 而言),映像可能無法執行
1>OPENCV.obj : warning LNK4248: 無法解析的 typeref 語彙基元 (01000029) (對 'CvCapture' 而言),映像可能無法執行
1>OPENCV.obj : warning LNK4248: 無法解析的 typeref 語彙基元 (0100002A) (對 '_CvContourScanner' 而言),映像可能無法執行
1>OPENCV.obj : error LNK2001: 無法解析的外部符號 "public: virtual void __thiscall cv::HOGDescriptor::setSVMDetector(class std::vector<float,class std::allocator<float> > const &)" (?setSVMDetector@HOGDescriptor@cv@@UAEXABV?$vector@MV?$allocator@M@std@@@std@@@Z)
1>OPENCV.obj : error LNK2001: 無法解析的外部符號 "public: virtual bool __thiscall cv::HOGDescriptor::read(class cv::FileNode &)" (?read@HOGDescriptor@cv@@UAE_NAAVFileNode@2@@Z)
1>OPENCV.obj : error LNK2001: 無法解析的外部符號 "public: virtual void __thiscall cv::HOGDescriptor::write(class cv::FileStorage &,class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &)const " (?write@HOGDescriptor@cv@@UBEXAAVFileStorage@2@ABV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@Z)
1>OPENCV.obj : error LNK2001: 無法解析的外部符號 "public: virtual bool __thiscall cv::HOGDescriptor::load(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &,class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &)" (?load@HOGDescriptor@cv@@UAE_NABV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@0@Z)
1>OPENCV.obj : error LNK2001: 無法解析的外部符號 "public: virtual void __thiscall cv::HOGDescriptor::save(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &,class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &)const " (?save@HOGDescriptor@cv@@UBEXABV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@0@Z)
1>OPENCV.obj : error LNK2001: 無法解析的外部符號 "public: virtual void __thiscall cv::HOGDescriptor::copyTo(struct cv::HOGDescriptor &)const " (?copyTo@HOGDescriptor@cv@@UBEXAAU12@@Z)
1>OPENCV.obj : error LNK2001: 無法解析的外部符號 "public: virtual void __thiscall cv::HOGDescriptor::compute(class cv::Mat const &,class std::vector<float,class std::allocator<float> > &,class cv::Size_<int>,class cv::Size_<int>,class std::vector<class cv::Point_<int>,class std::allocator<class cv::Point_<int> > > const &)const " (?compute@HOGDescriptor@cv@@UBEXABVMat@2@AAV?$vector@MV?$allocator@M@std@@@std@@V?$Size_@H@2@2ABV?$vector@V?$Point_@H@cv@@V?$allocator@V?$Point_@H@cv@@@std@@@5@@Z)
1>OPENCV.obj : error LNK2001: 無法解析的外部符號 "public: virtual void __thiscall cv::HOGDescriptor::detect(class cv::Mat const &,class std::vector<class cv::Point_<int>,class std::allocator<class cv::Point_<int> > > &,double,class cv::Size_<int>,class cv::Size_<int>,class std::vector<class cv::Point_<int>,class std::allocator<class cv::Point_<int> > > const &)const " (?detect@HOGDescriptor@cv@@UBEXABVMat@2@AAV?$vector@V?$Point_@H@cv@@V?$allocator@V?$Point_@H@cv@@@std@@@std@@NV?$Size_@H@2@2ABV45@@Z)
1>OPENCV.obj : error LNK2001: 無法解析的外部符號 "public: virtual void __thiscall cv::HOGDescriptor::detectMultiScale(class cv::Mat const &,class std::vector<class cv::Rect_<int>,class std::allocator<class cv::Rect_<int> > > &,double,class cv::Size_<int>,class cv::Size_<int>,double,int)const " (?detectMultiScale@HOGDescriptor@cv@@UBEXABVMat@2@AAV?$vector@V?$Rect_@H@cv@@V?$allocator@V?$Rect_@H@cv@@@std@@@std@@NV?$Size_@H@2@2NH@Z)
1>OPENCV.obj : error LNK2001: 無法解析的外部符號 "public: virtual void __thiscall cv::HOGDescriptor::computeGradient(class cv::Mat const &,class cv::Mat &,class cv::Mat &,class cv::Size_<int>,class cv::Size_<int>)const " (?computeGradient@HOGDescriptor@cv@@UBEXABVMat@2@AAV32@1V?$Size_@H@2@2@Z)
1>C:\Users\Devil-Zelda\OPENCV\Debug\OPENCV.exe : fatal error LNK1120: 10 個無法解析的外部符號
zelda1228
OpenCV幼儿园宝宝
 
帖子: 2
注册: 2011-07-29 12:17


回到 OpenCV新兵

在线用户

正在浏览此版面的用户:Google [Bot] 和 16 位游客