我使用的是Opencv 3.1,Cmake 3.6.0,Cuda 7.5,Visual Studio 2013。
我在x64机器上成功编译了自己的Opencv库,现在我可以使用CUDA模块了
我尝试用 qt 5.6.1 编译它,但我不能
当我选中复选框 WITH>关于cmake-gui的QT 我没有问题。但是当我构建ALL BUILD项目时,它会抛出以下内容:
window_QT.obj:错误LNK2001:未解析的外部符号" public: static struct QMetaObject const ...
我已经使用qt instaler并从源代码编译qt 我已经把lib和bin目录放在了VSproject上,但我无法解决链接问题 谢谢..
答案 0 :(得分:1)
对于OpenCV 3.1,以下是适用于我的配置:
TEMPLATE = app
CONFIG += console c++11
CONFIG -= app_bundle
CONFIG -= qt
SOURCES += main.cpp
TARGET = main
INCLUDEPATH += C:/opencv-3.1.0/opencv/build/include
LIBS += -LC:/opencv-3.1.0/opencv/build/x64/vc14/lib
LIBS += -LC:/opencv-3.1.0/opencv/build/x64/vc14/bin
CONFIG(debug,debug|release)
{
LIBS += -lopencv_world310d
}
CONFIG(release,debug|release)
{
LIBS += -lopencv_world310
}
答案 1 :(得分:1)
要向OpenCV 3.1添加Qt支持,请按照以下说明操作:https://gist.github.com/BartG95/1ce8ba1e9c25ec3698d1
并在构建过程中将/APPCONTAINER:NO
添加到以下属性,否则将无效:
CMAKE_EXE_LINKER_FLAGS
CMAKE_MODULE_LINKER_FLAGS
CMAKE_SHARED_LINKER_FLAGS
这是我工作的.pro文件:
TEMPLATE = app
CONFIG += console c++11
CONFIG -= app_bundle
CONFIG -= qt
SOURCES += main.cpp
TARGET = main
INCLUDEPATH += D:/Fouad/dev/Libs/opencv-3.1.0/opencv/build-with-qt-support/install/include
INCLUDEPATH += D:/Fouad/dev/Libs/opencv-3.1.0/opencv/dep/tbb2017_20161004oss/include
LIBS += -LD:/Fouad/dev/Libs/opencv-3.1.0/opencv/build-with-qt-support/install/x64/vc14/bin
LIBS += -LD:/Fouad/dev/Libs/opencv-3.1.0/opencv/build-with-qt-support/install/x64/vc14/lib
LIBS += -LD:/Fouad/dev/Libs/opencv-3.1.0/opencv/build-with-qt-support/install/x64/vc14/staticlib
LIBS += -LD:/Fouad/dev/Libs/opencv-3.1.0/opencv/dep/tbb2017_20161004oss/bin/intel64/vc14_ui
LIBS += -LD:/Fouad/dev/Libs/opencv-3.1.0/opencv/dep/tbb2017_20161004oss/lib/intel64/vc14_ui
LIBS += -lippicvmt
CONFIG(debug, debug|release)
{
LIBS += -lopencv_calib3d310d
LIBS += -lopencv_core310d
LIBS += -lopencv_features2d310d
LIBS += -lopencv_flann310d
LIBS += -lopencv_highgui310d
LIBS += -lopencv_imgcodecs310d
LIBS += -lopencv_imgproc310d
LIBS += -lopencv_ml310d
LIBS += -lopencv_objdetect310d
LIBS += -lopencv_photo310d
LIBS += -lopencv_shape310d
LIBS += -lopencv_stitching310d
LIBS += -lopencv_superres310d
LIBS += -lopencv_video310d
LIBS += -lopencv_videoio310d
LIBS += -lopencv_videostab310d
LIBS += -ltbb_debug
LIBS += -ltbb_preview_debug
LIBS += -ltbbmalloc_debug
LIBS += -ltbbmalloc_proxy_debug
LIBS += -ltbbproxy_debug
}
CONFIG(release, debug|release)
{
LIBS += -lopencv_calib3d310
LIBS += -lopencv_core310
LIBS += -lopencv_features2d310
LIBS += -lopencv_flann310
LIBS += -lopencv_highgui310
LIBS += -lopencv_imgcodecs310
LIBS += -lopencv_imgproc310
LIBS += -lopencv_ml310
LIBS += -lopencv_objdetect310
LIBS += -lopencv_photo310
LIBS += -lopencv_shape310
LIBS += -lopencv_stitching310
LIBS += -lopencv_superres310
LIBS += -lopencv_video310
LIBS += -lopencv_videoio310
LIBS += -lopencv_videostab310
LIBS += -ltbb
LIBS += -ltbb_preview
LIBS += -ltbbmalloc
LIBS += -ltbbmalloc_proxy
LIBS += -ltbbproxy
}