C:\Users\Public\Documents\MVTec\HALCON-13.0\examples\cpp\qt
C:\Users\Public\Documents\MVTec\HALCON-13.0\examples\
找不到的话,请找一下环境变量中:%HALCONEXAMPLES%\ 对应的值;
这里已经有一个写好的案例,win7 32bit 电脑,QT5.6.2 VS2013 32bit测试ok;
在Qt creator下面测试通过的;
关键在于.pro文件的配置:
脚本是这样的:
# HALCON/Qt pattern matching and measure example
#
# (c) 2004-2017 MVTec Software GmbH
# matching.pro
#
CONFIG += qt debug
QT += core gui widgets
# MacOS specific settings. Note that while dyld will search under
# /Library/Frameworks by default, the preprocessor/compiler/linker will not
# and need to be told explicitly.
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"
}
#sources
HEADERS += qhalconwindow.h
HEADERS += matching.h
SOURCES += qhalconwindow.cpp
SOURCES += matching.cpp
SOURCES += main.cpp
实际上关键在于包含:
$$(HALCONROOT)/include/halconcpp/HalconCpp.h 头文件
以及引用如下库:
$$(HALCONROOT)/lib/$$(HALCONARCH)/halconcpp.lib对应的
$$(HALCONROOT)/bin/$$(HALCONARCH)/halconcpp.dll
不用写出来