Hello,
I've been looking for a solution to my problem for a while, but none of the given solutions worked, so I decided to ask myself.
The only fault I get is ":-1: error: collect2: ld returned 1 exit status".
But "/TestApplication/sample/mainwindow.cpp:52: undefined reference to `HoGDetector::HoGDetector(int)'" makes me assume that it is an inclusion-Problem.
(i reduced the code, so I would still get the same problem, but i left all the includes)
mainwindow.cpp:
#include "mainwindow.h"
#include "ui_mainwindow.h"
#include <opencv/cv.h>
#include <opencv/highgui.h>
#include <string>
#include <iostream>
#include <fstream>
#include <detection.h>
#include <detector.h>
#include <HoGDetector.h>
#include <VJDetector.h>
#include "im/data.h"
#include "im/io.h"
//#include <postprocess.h>
#include <stdio.h>
using namespace std;
#ifdef TIME
extern "C"{
#include "rs/time.h"
}
#endif
HoGDetector* detector;
MainWindow
::MainWindow(QWidget *parent
) : ui(new Ui::MainWindow)
{
ui->setupUi(this);
}
MainWindow::~MainWindow()
{
delete ui;
}
void MainWindow
::changeEvent(QEvent *e
) {
switch (e->type()) {
ui->retranslateUi(this);
break;
default:
break;
}
int verbosity = 1;
HoGDetector* detector = new HoGDetector(verbosity);
}
#include "mainwindow.h"
#include "ui_mainwindow.h"
#include <opencv/cv.h>
#include <opencv/highgui.h>
#include <string>
#include <iostream>
#include <fstream>
#include <detection.h>
#include <detector.h>
#include <HoGDetector.h>
#include <VJDetector.h>
#include "im/data.h"
#include "im/io.h"
//#include <postprocess.h>
#include <stdio.h>
using namespace std;
#ifdef TIME
extern "C"{
#include "rs/time.h"
}
#endif
HoGDetector* detector;
MainWindow::MainWindow(QWidget *parent) :
QMainWindow(parent),
ui(new Ui::MainWindow)
{
ui->setupUi(this);
}
MainWindow::~MainWindow()
{
delete ui;
}
void MainWindow::changeEvent(QEvent *e)
{
QMainWindow::changeEvent(e);
switch (e->type()) {
case QEvent::LanguageChange:
ui->retranslateUi(this);
break;
default:
break;
}
int verbosity = 1;
HoGDetector* detector = new HoGDetector(verbosity);
}
To copy to clipboard, switch view to plain text mode
mainwindow.h
#ifndef MAINWINDOW_H
#define MAINWINDOW_H
#include <QMainWindow>
#include <opencv/cv.h>
#include <opencv/highgui.h>
#include <string>
#include <detection.h>
#include <detector.h>
#include <HoGDetector.h>
#include <VJDetector.h>
#include <postprocess.h>
namespace Ui {
class MainWindow;
}
Q_OBJECT
public:
~MainWindow();
protected:
private:
Ui::MainWindow *ui;
};
#endif // MAINWINDOW_H
#ifndef MAINWINDOW_H
#define MAINWINDOW_H
#include <QMainWindow>
#include <opencv/cv.h>
#include <opencv/highgui.h>
#include <string>
#include <detection.h>
#include <detector.h>
#include <HoGDetector.h>
#include <VJDetector.h>
#include <postprocess.h>
namespace Ui {
class MainWindow;
}
class MainWindow : public QMainWindow {
Q_OBJECT
public:
MainWindow(QWidget *parent = 0);
~MainWindow();
protected:
void changeEvent(QEvent *e);
private:
Ui::MainWindow *ui;
};
#endif // MAINWINDOW_H
To copy to clipboard, switch view to plain text mode
sample.pro
TARGET = TestApplication
TEMPLATE = app
SOURCES += main.cpp \
mainwindow.cpp
HEADERS += mainwindow.h
FORMS += mainwindow.ui
INCLUDEPATH += /vol/opencv/include \
/vol/is/include \
/vol/is/contrib/include \
/vol/esmeralda/include \
/vol/is/contrib/include/ml \
/vol/is/contrib/include/iul
LIBS += -L/vol/opencv/lib \
-L/vol/is/lib \
-L/vol/is/contrib/lib \
-L/vol/esmeralda/lib \
-L/vol/is/contrib/lib/ml/lib \
-L/vol/is/contrib/lib/iul \
-lcxcore \
-lcv \
-lhighgui \
-lcvaux \
-lim \
-lmx \
-lrs \
-lz \
-lm \
-ldl \
-lpthread \
-lImageUtilityLibrary \
-lMathLibrary \
-lfloatfann \
-lhistogram \
-lmeanshift
TARGET = TestApplication
TEMPLATE = app
SOURCES += main.cpp \
mainwindow.cpp
HEADERS += mainwindow.h
FORMS += mainwindow.ui
INCLUDEPATH += /vol/opencv/include \
/vol/is/include \
/vol/is/contrib/include \
/vol/esmeralda/include \
/vol/is/contrib/include/ml \
/vol/is/contrib/include/iul
LIBS += -L/vol/opencv/lib \
-L/vol/is/lib \
-L/vol/is/contrib/lib \
-L/vol/esmeralda/lib \
-L/vol/is/contrib/lib/ml/lib \
-L/vol/is/contrib/lib/iul \
-lcxcore \
-lcv \
-lhighgui \
-lcvaux \
-lim \
-lmx \
-lrs \
-lz \
-lm \
-ldl \
-lpthread \
-lImageUtilityLibrary \
-lMathLibrary \
-lfloatfann \
-lhistogram \
-lmeanshift
To copy to clipboard, switch view to plain text mode
i also used the bashrc-file using:
" source ~/.bashrc "
and checked with echo $LD_LIBRARY_PATH that all the necessary paths were included
"/vol/opencv/lib:/vol/qt/lib:/export/usr/share/jre/1.5/lib/i386/:/vol/esmeralda/lib:/vol/is/contrib/lib:/vol/is/lib:/export/usr/lib:/vol/robot/share/MetraLabs/tmp/opt/MetraLabs/lib:"
The file HoGDetect.h is in the folder: "/vol/is/contrib"
As I am new to Qt, C++ and Linux this is giving me headaches.
I really hope I did not forget anything important.
Thank you for your advices in advance
Bookmarks