Halcon学习笔记(1):Qt+Halcon联合开发配置
首先是新建一个QT项目qtest_hc
方法一:
1)QT项目文件 qtest_hc 添加库:
#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)
macx {QMAKE_CXXFLAGS += -F/Library/FrameworksQMAKE_LFLAGS += -F/Library/FrameworksLIBS += -framework HALCONCpp
}
else {#defineswin32:DEFINES += WIN32#includesINCLUDEPATH += "$$(HALCONROOT)/include"INCLUDEPATH += "$$(HALCONROOT)/include/halconcpp"#libsQMAKE_LIBDIR += "$$(HALCONROOT)/lib/$$(HALCONARCH)"unix:LIBS += -lhalconcpp -lhalcon -lXext -lX11 -ldl -lpthreadwin32:LIBS += "$$(HALCONROOT)/lib/$$(HALCONARCH)/halconcpp.lib" \"$$(HALCONROOT)/lib/$$(HALCONARCH)/halcon.lib"
}