首先在文件project.pro下添加halcon文件的lib以及include。
macx {
QMAKE_CXXFLAGS += -F/Library/Frameworks
QMAKE_LFLAGS += -F/Library/Frameworks
LIBS += -framework HALCONCpp
}
else {
#defines
win32:DEFINES += WIN32
#includes
INCLUDEPATH += "$$(HALCONROOT)/include"
INCLUDEPATH += "$$(HALCONROOT)/include/halconcpp"
#libs
QMAKE_LIBDIR += "$$(HALCONROOT)/lib/$$(HALCONARCH)"
unix:LIBS += -lhalconcpp -lhalcon -lXext -lX11 -ldl -lpthread
win32:LIBS += "$$(HALCONROOT)/lib/$$(HALCONARCH)/halconcpp.lib" \
"$$(HALCONROOT)/lib/$$(HALCONARCH)/halcon.lib"
}
这里是引用
.h文件代码如下
#ifndef CAMERASET_H
#define CAMERASET_H
#include <QDialog>
namespace Ui {
class cameraset;
}
class cameraset : public QDialog
{
Q_OBJECT
public:
explicit cameraset(QWidget *parent = 0);
~cameraset();
private:
Ui::cameraset *ui;
};
#endif // CAMERASET_H
.cpp文件代码如下
#include "testset.h"
#include "ui_testset.h"
testset::testset(QWidget *parent) :
QDialog(parent),
ui(new Ui::testset)
{
ui->setupUi(this);
}
testset::~testset()
{
delete ui;
}
void testset::on_pushButton_load_image_clicked