创建新项目,CMakeList.txt中写入:
cmake_minimum_required(VERSION 3.24)
project(untitled1)
include_directories("C:/Users/62359/AppData/Local/Programs/MVTec/HALCON-22.05-Progress/include/halconcpp")
include_directories("C:/Users/62359/AppData/Local/Programs/MVTec/HALCON-22.05-Progress/include")
set(CMAKE_CXX_STANDARD 11)
link_directories("C:/Users/62359/AppData/Local/Programs/MVTec/HALCON-22.05-Progress/lib/x64-win64")
add_executable(untitled1 main.cpp)
target_link_libraries(untitled1 "C:/Users/62359/AppData/Local/Programs/MVTec/HALCON-22.05-Progress/lib/x64-win64/halconcpp.lib")
运行demo,会报错:
这时候在C:\Users\62359\AppData\Local\Programs\MVTec\HALCON-22.05-Progress\bin\x64-win64下自己安排搭配这halcon.dll和halconcpp.dll这两个文件,拷到下方的位置。
点击项目exe文件,即可运行成功。
目前还没解决的问题:从Clion中运行,会报错。有时候是dll文件读取错误,有时候是下图:
欢迎大佬解答疑惑。