Halcon学习笔记(一):Qt+Halcon联合开发配置

Halcon学习笔记(1):Qt+Halcon联合开发配置

首先是新建一个QT项目qtest_hc
Halcon学习笔记(一):Qt+Halcon联合开发配置_第1张图片

方法一:

1)QT项目文件 qtest_hc 添加库:

Halcon学习笔记(一):Qt+Halcon联合开发配置_第2张图片
Halcon学习笔记(一):Qt+Halcon联合开发配置_第3张图片Halcon学习笔记(一):Qt+Halcon联合开发配置_第4张图片

#1.包含目录添加
INCLUDEPATH += D:/MVTec/HALCON-13.0/include
INCLUDEPATH += D:/MVTec/HALCON-13.0/include/halconcpp

#2.链接库文件添加
win32:LIBS += -LD:/MVTec/HALCON-13.0/lib/x64-win64/ -lhalcon
LIBS += -LD:/MVTec/HALCON-13.0/lib/x64-win64/ -lhalcon
LIBS += -LD:/MVTec/HALCON-13.0/lib/x64-win64/ -lhalconc
LIBS += -LD:/MVTec/HALCON-13.0/lib/x64-win64/ -lhalconcpp
LIBS += -LD:/MVTec/HALCON-13.0/lib/x64-win64/ -lhalconcpp10
LIBS += -LD:/MVTec/HALCON-13.0/lib/x64-win64/ -lhalconcpp10xl
LIBS += -LD:/MVTec/HALCON-13.0/lib/x64-win64/ -lhalconcppxl
LIBS += -LD:/MVTec/HALCON-13.0/lib/x64-win64/ -lhalconcxl
LIBS += -LD:/MVTec/HALCON-13.0/lib/x64-win64/ -lhalconx
LIBS += -LD:/MVTec/HALCON-13.0/lib/x64-win64/ -lhalconxl
LIBS += -LD:/MVTec/HALCON-13.0/lib/x64-win64/ -lhalconxxl
LIBS += -LD:/MVTec/HALCON-13.0/lib/x64-win64/ -lhdevenginecpp
LIBS += -LD:/MVTec/HALCON-13.0/lib/x64-win64/ -lhdevenginecpp10
LIBS += -LD:/MVTec/HALCON-13.0/lib/x64-win64/ -lhdevenginecpp10xl
LIBS += -LD:/MVTec/HALCON-13.0/lib/x64-win64/ -lhdevenginecppxl
LIBS += -LD:/MVTec/HALCON-13.0/lib/x64-win64/ -lhdevenginex
LIBS += -LD:/MVTec/HALCON-13.0/lib/x64-win64/ -lhdevenginexxl

#3.包含路径添加
INCLUDEPATH += D:/MVTec/HALCON-13.0/lib/x64-win64
DEPENDPATH += D:/MVTec/HALCON-13.0/lib/x64-win64

方法二:

直接复制以下代码到.pro文件中:
这个方法的前提是,Halcon 安装时系统环境变量设置完全:

HALCONARCH=x64-win64
HALCONEXAMPLES=C:\Users\Public\Documents\MVTec\HALCON-12.0\examples
HALCONIMAGES=%HALCONEXAMPLES%\images
HALCONROOT=E:\MVTec\HALCON-13.0
(或者是HALCONROOT=C:\Program Files\MVTec\HALCON-17.12-Progress)

Halcon学习笔记(一):Qt+Halcon联合开发配置_第5张图片

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"
}

你可能感兴趣的:(QT,HALCON,环境安装)