首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 移动开发 > QT开发 >

error: collect2: ld returned 1 exit status 请帮 小弟我看看程序时哪里有有关问题

2012-03-07 
error: collect2: ld returned 1 exit status 请帮 我看看程序时哪里有问题本人用qt creator 创建了一个gu

error: collect2: ld returned 1 exit status 请帮 我看看程序时哪里有问题
本人用qt creator 创建了一个gui application

MyTest.h

C/C++ code
#ifndef MYTEST_H#define MYTEST_H#include <QtGui/QWidget>#include <cv.h>#include <QImage>#include <QtCore>#include <highgui.h>class MyTest : public QWidget{    Q_OBJECTpublic:    MyTest(QWidget *parent = 0);    ~MyTest();    void showImage(char *filename);    QImage& pConvQImage(IplImage *p,QImage &q);private:    IplImage * pImage;    QImage qImage;};#endif // MYTEST_H



MyTest.cpp

C/C++ code
#include "mytest.h"#include <QPainter>MyTest::MyTest(QWidget *parent)    : QWidget(parent){    this->showImage("lena.jpg");}MyTest::~MyTest(){}void MyTest::showImage(char *filename){    pImage = cvLoadImage(filename,1);    QPainter q;    q.drawImage(this->rect(),pConvQImage(pImage,qImage));}QImage& MyTest::pConvQImage(IplImage *p, QImage &q){    q = QImage((const uchar*)p->imageData,p->width,p->height,p->widthStep,QImage::Format_RGB888);    return q;}



main.cpp

C/C++ code
#include <QtGui/QApplication>#include "mytest.h"int main(int argc, char *argv[]){    QApplication a(argc, argv);    MyTest w;    w.show();    return a.exec();}



test_OpenCV4.pro
C/C++ code
TARGET = test_OpenCV4TEMPLATE = appSOURCES += main.cpp\        mytest.cppHEADERS  += mytest.hINCLUDEPATH += D:\OpenCV2.0\include\opencv \    LIBS \    += \    D:\OpenCV2.0\lib



运行的时候就出现一个错误,但是找不到错误在哪里,请高手指点一二

Assembly code
D:/learning/workspace/test_OpenCV4/mytest.cpp:17: undefined reference to `cvLoadImage':-1: error: collect2: ld returned 1 exit status


[解决办法]
pImage = cvLoadImage(filename,1);
没找到这个函数在那声明定义的,你自己再找找吧
[解决办法]
重复的帖子...
http://topic.csdn.net/u/20100307/12/08f62883-7019-47eb-8767-899301027a43.html

热点排行