Qt配置Halcon
QtCreator:
方法一:链接外部动态库
------->
(库文件,添加halcon.lib以及halconcpp.lib。特别强调:取消勾选红框出得debug后缀)
添加头文件引用:
INCLUDEPATH += $$PWD/include INCLUDEPATH += $$PWD/include/hlib INCLUDEPATH += $$PWD/include/halconcpp
方法二:通过环境变量
直接复制mvtec文件夹下samples的qt案例下pro文件内容
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" }
VS2017:
添加:
$(HALCONROOT)/include $(HALCONROOT)/include/halconcpp
添加:
$(HALCONROOT)\lib\$(HALCONARCH);
添加:
halcon.cpp
最后在头文件中:
#include "halconcpp.h" using namespace HalconCpp;