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
Related
I am creating a GUI app with Qt creator to communicate with an esp32 and control the outputs. I am currently using Qt 6.4 version, I know lib is not available in 6.0 or 6.1 but I couldn't find anything on 6.4.
This pages advices to input QT += serial port; https://doc.qt.io/qt-6/qtserialport-index.html. In my Qt app my.pro file I declare this:
QT += core gui serialport
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
TARGET = serialRead
TEMPLATE = app
CONFIG += c++17
# You can make your code fail to compile if it uses deprecated APIs.
# In order to do so, uncomment the following line.
DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0
SOURCES += \
main.cpp \
mainwindow.cpp
HEADERS += \
mainwindow.h
FORMS += \
mainwindow.ui
# Default rules for deployment.
qnx: target.path = /tmp/$${TARGET}/bin
else: unix:!android: target.path = /opt/$${TARGET}/bin
!isEmpty(target.path): INSTALLS += target
Error Message:
:-1: error: Project ERROR: Unknown module(s) in QT: serialport
I still dont know what to do to be able to use the QSerialPort library. I would appreciate any guidance. Thank you!
I solved the same issue with https://wiki.qt.io/Qt_Serial_Port
Install Perl (i.e Strawberry Perl)
Clone the qtserialport repo
git clone git://code.qt.io/qt/qtserialport.git
cd qtserialport
Checkout to suitable branch (you can list present branches with "git branch -a")
git checkout remotes/origin/6.3.1
Open qtserialport project with Qt Creator via CMakeLists.txt
In the "Projects" tab find "Build Steps" group, expand "Details" and check "install"
Rebuild the project from menu "Build->Rebuild"
It would be installed automatically. You may check it in the "Compile output". Note, that you have to rebuild the project for each build configuration you need.
Hope it will helps.
Use the application QT Maintenance Tool to add serialport lib.
I've visit these blogs
https://zahidhasan.wordpress.com/2014/08/19/qt-5-3-1-64-bit-mingw-windows/
How to link opencv in QtCreator and use Qt library
http://www.cnblogs.com/grandyang/p/4328896.html
All of them are using Mingw to compile Opencv through Cmake.
If I want to use Opencv in QT, is compiling with Mingw the only way?
I have this question because I already compiled my Opencv 2.4.11 with Visual Studio 2013(in Cmake---Visual Studio 12 2013 Win64),
when I follow the directions setting up the INCLUDEPATH and LIBS in QT
"C:\\opencv2.4.11\\opencv\\build\\include\\opencv"
"C:\\opencv2.4.11\\opencv\\build\\include\\opencv2"
-L"C:\\opencv2.4.11\\opencv\\build\\x64\\vc12\\lib" \
-lopencv_core2411 \
-lopencv_highgui2411 \
-lopencv_imgproc2411 \
-lopencv_features2d2411 \
-lopencv_calib3d2411 \
I get this error message:
C1083:Cannot open include file:'opencv2/opencv.hpp': No such file or directory
You can compile it with Visual Studio as well. The opencv includepaths already have the opencv2 part of it. So the correct includepath would only be:
C:\\opencv2.4.11\\opencv\\build\\include
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.
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.