I have problems with setting up Qt with opencv:
With Qt5 cMake unable to finish the configuration. Luckily with Qt4 it works fine. (default only Qt)
mingw32-make
mingw32-make install
(this runs without error)
But when I use InputVideo which is in highgui, it stops runtime.
Checking with dependecy walker, the LIBOPENCV_HIGHGUI246.DLL has dependecies like:
API-MS-WIN-CORE-KERNEL32-PRIVATE-L1-1-1.DLL
API-MS-WIN-CORE-PRIVATEPROFILE-L1-1-1.DLL
API-MS-WIN-SERVICE-PRIVATE-L1-1-1.DLL
...
these are in theory part of windows8. How can i fix this problem?
(besides moving all dll-s near my executable)
I managed to configure a Qt Creator project with OpenCV to run a simple OpenCV application I wrote recently, named cvDisplacementMapFilter.
I tested it with OpenCV 2.4.7 on Mac OS X 10.7.5 and OpenCV 2.4.2 on Windows 7. I believe the following .pro file can help you:
SOURCES += \
main.cpp
# On my system I have to specify g++ as compiler else it will use clang++ by default
QMAKE_CXX=g++
QMAKE_CC=gcc
## OpenCV settings for Unix/Linux
unix:!mac {
message("* Using settings for Unix/Linux.")
INCLUDEPATH += /usr/local/include/opencv
LIBS += -L/usr/local/lib/ \
-lopencv_core \
-lopencv_highgui \
-lopencv_imgproc
}
## OpenCV settings for Mac OS X
macx {
message("* Using settings for Mac OS X.")
INCLUDEPATH += /usr/local/include/opencv
LIBS += -L/usr/local/lib/ \
-lopencv_core \
-lopencv_highgui \
-lopencv_imgproc
}
## OpenCV settings for Windows and OpenCV 2.4.2
win32 {
message("* Using settings for Windows.")
INCLUDEPATH += "C:\\opencv\\build\\include" \
"C:\\opencv\\build\\include\\opencv" \
"C:\\opencv\\build\\include\\opencv2"
LIBS += -L"C:\\opencv\\build\\x86\\vc10\\lib" \
-lopencv_core242 \
-lopencv_highgui242 \
-lopencv_imgproc242
}
Don't forget to change the paths and version of OpenCV at win32.
Related
I Have a project that uses QT Bluetooth and i managed to compile it up until today
Today when calling QMake I get
Project MESSAGE: Warning: unknown QT: bluetooth
the .pro file looks something like this:
######################################################################
# Automatically generated by qmake (3.0) Thu Sep 29 10:34:51 2016
######################################################################
QT += bluetooth
QT += core
QT -= gui
CONFIG += c++11
CONFIG += debug
TEMPLATE = app
TARGET = build/ankioverdrive
#INCLUDEPATH += .
LIBS += -lmosquittopp
LIBS += -L/usr/lib
INCLUDEPATH += /usr/include/
# Input
SOURCES += some/paths/to/files.cpp \
HEADERS += \
some/paths/to/files.h \
running qmake --version which seemd to be the problem for some before gave me
QMake version 3.1
Using Qt version 5.9.5 in /usr/lib/x86_64-linux-gnu
I'm on Kubuntu 18.04
I fixed the Problem by reinstalling Qt via the qt-unified install tool for linux, and running the qmake file in that installPath
PathToInstallation/version/gcc_64/bin/qmake
this worked
I have been struggling recently to get opencv to work with qt. At this moment my issue is this: It cant find the libraries. No matter what I do it says the same thing:
:-1: error: LNK1104: cannot open file 'opencv_improc245d.lib'
I included the bin in my path variable, and added each file to libs:
INCLUDEPATH += C:\\OpenCV-2.4.5\\opencv\\build\\include
LIBS += -LC:\\OpenCV-2.4.5\\mybuild\\lib\\Debug \
-lopencv_calib3d245d \
-lopencv_contrib245d \
-lopencv_core245d \
-lopencv_features2d245d \
-lopencv_flann245d \
-lopencv_gpu245d \
-lopencv_highgui245d \
-lopencv_improc245d \
-lopencv_legacy245d \
-lopencv_ ml245d \
-lopencv_ objdetect245d \
-lopencv_ ts245d \
-lopencv_ video245d
also, my opencv library is compiled from source for msvc2010 with qt enabled, and my qt is using msvc2010 as it's compiler.
Am I adding the libraries wrong or is something wrong with my includepath?
Look in the leftmost pane of Qt Creator. There is a Projects tab. (ctrl+5) should reach you there. Go to Build Environment. Click on Details to get list of System Environment Variables. Goto INCLUDE variable in the list. Select and click Edit. Add path_to_opencv/opencv/build/include.
[ path_to_opencv is the path where your opencv directory resides.]
Clean the project, run qmake and build the project again.
I'm writing a small C++ program (with a GUI) with Qt Creator and compiling with MinGW. Everything works fine when I compile the project in debug mode but as soon as I move to release mode I get compiler errors:
undefined reference to 'std::out_of_range::~out_of_range()' thread.cpp
When I click on the error I also get:
File not found: thread.cpp
I have looked through my Boost installation and found thread.cpp and it should be on the include path for my project.
Any ideas?
EDIT: Here is my .pro file:
#-------------------------------------------------
#
# Project created by QtCreator 2012-08-10T12:09:39
#
#-------------------------------------------------
QT += core gui
TARGET = GeneDropWin
TEMPLATE = app
SOURCES += main.cpp \
genedrop.cpp \
mainbody.cpp \
biofunctions.cpp \
fileio.cpp \
settings.cpp
HEADERS += genedrop.h \
geneclasses.h \
paramclass.h \
mainbody.h \
biofunctions.h \
fileio.h \
geneclasses.h \
settings.h
FORMS += genedrop.ui \
settings.ui
#Stuff I've added
INCLUDEPATH += "C:\\Program Files\\boost_1_50_0"
LIBS += -L"C:\\Program Files\\boost_1_50_0\\stage\\lib" -lboost_thread-mgw46-mt-1_50 -lboost_system-mgw46-mt-1_50 -lboost_date_time-mgw46-mt-1_50 -lboost_chrono-mgw46-mt-1_50
CONFIG += static \
release
RESOURCES += \
NIABLogo.qrc
Ok, the problem is fixed but perhaps not completely understood. I fixed it by switching compiler to MSVC and changing the syntax for the linker options (e.g. -lboost_thread-mgw46-mt-1_50 -> -llibboost_thread-vc100-mt-1_50), compiles without an issue now. I will put forward my reasoning as to what I think may have been the problem but would appreciate a better answer if wrong:
Although I thought I had built the Boost libraries with MinGW when looking through the installation I found a number of folders mentioning msvc instead (e.g. ...boost\bin.v2\libs\date_time\build_msvc-10.0) which suggested to me that I had built it with MSVC.
The linker error claimed not to be able to find files associated with thread.cpp.
Looking at the thread folder of the build directory all the .obj and .lib files had msvc-10.0 folders in their path.
Thus I think that the MinGW compiler was looking for boost objects within a non-existent MinGW folder and so was failing. The fact that it worked under debug mode I guess relates to a less-constrained search for files.
I built OpenCV with CMake under Visual studio 10, copied the binaries to a /bin folder in the opencv directory. I have a simple OpenCV program with no syntax errors, but I am getting several errors such as "undefined reference to cv::imread". Why is this?
My .pro file has the following appended at the end of it:
INCLUDEPATH += C:/opencv/build/include/
LIBS += -LC:/opencv/build/x64/vc10/lib \
-lopencv_core231 \
-lopencv_highgui231 \
-lopencv_imgproc231 \
-lopencv_features2d231 \
-lopencv_calib3d231
Thanks
undefined reference instead of unresolved external symbol means you are probably using MinGW for your application, and you can't use gcc with a VC++ compiled C++ library.
Is there any way to integrate Qt and Physx so i can use Physx inside Qt Creator?
Unfortunately PhysX is compiled against the /MT (static run-time version), while Qt MSVC uses /MD. Meaning you will have to build a Qt MSVC static build with /MT. Even if you get it to run using Qt's shared version you will run into the following warning and possible problems:
defaultlib 'LIBCMT' conflicts with use of other libs...
This stackoverflow answer will help you get you started for a qt static build: How to build Qt 4.8/5.2 statically under VS2012, using the static MSVC runtime, with Windows XP support?
To use the PhysX library with Qt MSVC (MinGW is not compatible with PhysX), here's an example qmake configuration.
PHYSX = /path/to/physx/library
INCLUDEPATH += $${PHYSX}/Include
LIBS += -L$${PHYSX}/Lib/win64
LIBS += \
-lPhysX3CharacterKinematic_x64 \
-lPhysX3_x64 \
-lPhysX3Common_x64 \
-lPhysX3Cooking_x64 \
-lPhysX3Extensions \
-lPhysX3Vehicle \
-lPhysXProfileSDK \
-lPhysXVisualDebuggerSDK \
-lPxTask