I am using Qt 5.15.2 and Win10 64-bit
I have just downloaded the GLFW source package from the original site, not the pre-compiled binaries. I do not know how to compile it with Qt. Then I would like to use it in Qt.
I know that there are pre-compiled binaries but those can use only in Visual Studio.
I know that there is an integrated QtOpenGL to Qt but I would like to use the "original" OpenGL.
Edit:
I downloaded the 64-bit GLFW package.
The files location C:/LIBS/glfw, folder contain the following files: glfw3.dll, glfw3dll.a, libglfw3.a, glfw3.h
.pro file
TEMPLATE = app
CONFIG += console c++11
CONFIG -= app_bundle
CONFIG -= qt
SOURCES += \
main.cpp
LIBS += -LC:/LIBS/glfw/ -lglfw3
INCLUDEPATH += C:/LIBS/glfw
DEPENDPATH += C:/LIBS/glfw
You don't have to compile the GLFW source package. The precompiled binary package contains binaries for both Visual Studio and MinGW.
You have to link the OpenGL binary, so your LIBS line in the .pro file should be:
LIBS += -LC:/LIBS/glfw/ -lglfw3 -lopengl32
And you may also have to append -lglu32 and/or -lgdi32 if you still get some additional link errors.
Related
I'm trying to cross compile Qt Quick Designer Components to get QtQuick.Studio.Effects module on Qt 6.5 on arm64 target as I'm getting "module 'QtQuick.Studio.Effects' is not installed" when I try to to run my cross compiled qt application.
So far I have cross compiled Qt Quick Designer Components with help of this and it outputs libQuickStudioEffects.a static library. I tried to link it in .Pro file by adding the library with qt creator which generated following lines.
unix:!macx: LIBS += -L/home/user/qt/ -lQuickStudioEffects
INCLUDEPATH += /home/user/qt/
DEPENDPATH += /home/user/qt/
unix:!macx: PRE_TARGETDEPS += /home/user/qt/libQuickStudioEffects.a
lib file and executable both are in /home/user/qt/ location in target and host pc.
also I tried with following line.
LIBS += /home/user/qt/libQuickStudioEffects.a
So far executable is not detecting the lib file and giving me the above mentioned error. I can run other cross compiled qt6 programs on my target device without any issue. My host runs Ubuntu 20 and target runs on debian 11. Any help is really appreciated. Thanks.
Build the dev branch from here and it will give the dynamic QtQuick.Studio.Effects library which can be cross compiled.
I am in the exact situation described in this question (Qt Creator on Mac and boost libraries) but the accepted answer is not working for me. I've searched around and tried all the suggestions I've found but I still end up with errors
Environment:
OSX 10.9.5
Qt 5.5.1 - Qt Creator 3.5.1 - installed using the Qt
installer
Boost 1.59.0 – installed through Homebrew
Am able to compile and run Qt apps
After creating a new Qt test application, when I add the Boost information to the .pro file (shown below) as described in the question linked above, I end up with very confusing compile errors within the Qt classes. I don't get it. Does anyone understand the conflict and know how to resolve this – I've been at it for hours now.
QT += core gui
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
TARGET = audiowaveform_test
TEMPLATE = app
SOURCES += main.cpp\
mainwindow.cpp
HEADERS += mainwindow.h
FORMS += mainwindow.ui
macx {
QMAKE_CXXFLAGS += -std=c++11
_BOOST_PATH = /usr/local/Cellar/boost/1.59.0
INCLUDEPATH += "$${_BOOST_PATH}/include/"
LIBS += -L$${_BOOST_PATH}/lib
## Use only one of these:
LIBS += -lboost_chrono-mt -lboost_system # using dynamic lib (not sure if you need that "-mt" at the end or not)
#LIBS += $${_BOOST_PATH}/lib/libboost_chrono-mt.a # using static lib
}
I finally got it working by changing this line in the .pro file:
QMAKE_CXXFLAGS += -std=c++11
to this:
CONFIG += c++11
If someone can explain what -std means in compiler speak, I would appreciate it. Does it mean that everything should be compiled as c++11?
A problem with a Qt *.pro file:
TARGET = ProgName
TEMPLATE = app
CONFIG += console
QT += core
QT += gui
LIBS += -LC:\\Qt\\4.8.5\\bin
LIBS += -LC:\\Qt\\4.8.5\\lib
LIBS += -LS:\\lib
# LIBS += -lQtCored4 # not necessary
# LIBS += -lQtCore4
# LIBS += -lQtGuid4
# LIBS += -lQtGui4
SOURCES += ...
HEADERS += ...
I get these linker errors:
:-1: error: cannot find -lQtGuid
:-1: error: cannot find -lQtCored
collect2.exe:-1: error: error: ld returned 1 exit status
All the DLLs exist in the specified directories.
The documentation did not help much.
This pro file worked a few days ago, and it seems to have issues since I installed Qt 5.1 (this is not used, yet; I am still working with Qt4).
Platform: Windows 7, MinGW, Qt 4.8.4
You only need the following content:
TARGET = ProgName
TEMPLATE = app
CONFIG += console
QT -= gui
SOURCES += ...
HEADERS += ...
That is because core and gui are added to the QT variable automatically. In this particular case however, you can remove the gui default if you wish to build a console application as you seem. Although "CONFIG += console" could eventually do that for you. Besides this, everything will work automatically for you, so you do not need to pass the library path to the qt libraries and so forth. You would only need to use QT += widgets and similar lines if you used further Qt modules there are not there by default. Even then, you would not need to set the Qt library path as you did in your question.
Besides, if you wanna target cross-platform later, you may wish to add this:
CONFIG -= app_bundle
to avoid creating Mac bundle for console based applications.
If you have multiple versions of Qt installed as it seems, you need to use the qmake from the required version, and it will be fine. Just to give an example: I use qmake for Qt 5 on my Archlinux system, and qmake-qt4 for Qt4.
On windows, you should either have the desired qt installation bin in the path before the undesired, or you need to call desired qmake explicitly, something like C:\path\to\my\desired\qmake.
There's no need to link to any Qt libraries afaik.
If you're using Qt Creator you need to make sure Qt 4.8.4 is properly recognized in Tools - Options - Build & Run - Kits. Since you installed 5.1 this may no longer be true. Then set the 4.8.4 kit for your project and compile it (cleaning the build directory also helps sometimes).
I have managed to compile PortAudio on windows using MSYS.
this process has created 2 files: libportaudio-2.dll and libportaudio.dll.a
Now i want to link the libraries in QtCreator, but i can not since it requires a .lib file.
If anybody have experience of compiling and using libraries with MSYS under windows, your input is appreciated.
(Note: they are compiled using MindGW compiler. I dont want to compile it with Microsoft Visual Studio, since then i will have to compile QT)
to solve your problem is very simple. Here I report an example of a file. pros who need to use:
QT += core
QT -= gui
TARGET = mioTestAudio
CONFIG += console
CONFIG -= app_bundle
TEMPLATE = app
LIBS += -lportaudio.dll <-------- this is the part you are interested
SOURCES += main.cpp
While building a game code in Qt simulator I'm getting the following error:
-1: error: LNK1104: cannot open file 'libEGL.lib'
I have added following code to add library files:
INCLUDEPATH +=
C:\Imagination_Technologies\POWERVR_SDK\OGLES2_WINDOWS_X86EMULATION_2.08.28.0634\Builds\OGLES2\Include\
LIBS +=
-LC:\Imagination_Technologies\POWERVR_SDK\OGLES2_WINDOWS_X86EMULATION_2.08.28.0634\Builds\OGLES2\WindowsX86\Lib\
-llibEGL -llibGLESv2
LIBS += -llibEGL -llibGLESv2
It's been some time since I stopped programming under Windows, but as far as I can remember qmake uses the same mechanism used in Linux on all the supported OS (http://doc.qt.io/qt-5/qmake-project-files.html). Which means you should write:
LIBS += -LC:\Imagination_Technologies\POWERVR_SDK\OGLES2_WINDOWS_X86EMULATION_2.08.28.0634\Builds\OGLES2\WindowsX86\Lib\ -lEGL -lGLESv2
provided the path is correct of course (note that I removed the 'lib').