I am creating a Webots project on OSX, where I am including the following:
#include <core/MainApplication.hpp>
I get error
In file included from
/Applications/Webots/resources/projects/default/libraries/qt_utils/core/MainApplication.hpp:17:
/Applications/Webots/webots.app/Contents/Frameworks/QtWidgets.framework/Headers/QApplication:1:10:
fatal error: 'qapplication.h' file not found
include "qapplication.h"
1 error generated.
All contnet of /Applications/Webots/webots.app/Contents/Frameworks/QtWidgets.framework/Headers/QApplication:
#include "qapplication.h"
QApplication file content is too short. Also it seems like I cannot find qapplication.h on the file system, is that normal?
Would it be more sensible to use local installation of Qt framework than the one that comes with Webots? How do I change the .pro file then to link to local installation of Qt rather than to /Applications/Webots/resources/projects/default/libraries/qt_utils
My make file:
CXX_SOURCES = entry_points.cpp
QT = core gui
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
USE_C_API = true
QT_UTILS = /Applications/Webots/resources/projects/default/libraries/qt_utils
INCLUDE = -I"$(QT_UTILS)"
LIBRARIES = -L"$(QT_UTILS)" -lqt_utils
space :=
space +=
WEBOTS_HOME_PATH=$(subst $(space),\ ,$(strip $(subst \,/,$(WEBOTS_HOME))))
include /Applications/Webots/resources/Makefile.include
EDIT:
I have discovered that when I try to run make in the folder: /Applications/Webots/resources/projects/default/libraries/qt_utils
I get many errors (among many others), such as:
/Applications/Webots/webots.app/Contents/Frameworks/QtWidgets.framework/Headers/QWidget:1:10:
fatal error: 'qwidget.h' file not found
include "qwidget.h"
...
/Applications/Webots/webots.app/Contents/Frameworks/QtCore.framework/Headers/QObject:1:10:
fatal error: 'qobject.h' file not found
include "qobject.h"
...
/Applications/Webots/webots.app/Contents/Frameworks/QtWidgets.framework/Headers/QApplication:1:10:
fatal error: 'qapplication.h' file not found
include "qapplication.h"
In facts, these files are indeed missing from the Webots qt_utils
This is probably because of this line:
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
Indeed, QT_MAJOR_VERSION and greaterThan are not a part of the Webots Makefile system. If the Qt widgets module is not present, then the qapplication.h cannot be found (because it is precisely defined in the widgets module). As Webots is using Qt 5 since a while, I would recommend you to simply define the Qt modules like this:
QT = core gui widgets
Related
Question is mainly on the title. Details are,
I am asked to convert a slightly old Qt project that is claimed to be compatible with 5.12, which seems it is not, to Qt 5.15 or higher. So, I am debugging errors and I saw,
#include <QtLocation/private/qgeomaptype_p.h>
...
QGeoMapType::MapStyle getMapStyle() { return _mapType; }
However, this doesn't work out in Qt 5.15.5. I googled the errors and can't get much.
Error output:
...MapProvider.h:35: error: Use of undeclared identifier 'QGeoMapType'
Okey, after a little more digging I realized that this file is in another directory in my system.
Qt\5.15.2\msvc2019_64\include\QtLocation\5.15.2\QtLocation\private
As you can see, because of 5.15.2 directory it seems Qt can't find the files. After I changed include path to
#include "QtLocation/5.15.2/QtLocation/private/qgeomaptype_p.h"
the filesystem can find it. However, now the problem is Qt can't find some files in qgeomaptype_p.h , all of them are missing QtLocation/5.15.2 prefix.
I have been created a build with Buildroot. Also did it everthing on this comment -> https://www.raspberrypi.org/forums/viewtopic.php?t=263418#p1614833
Did my research, and dozens of trials, and I get nothing.
My config is:
Rpi4-64, QT5-Qml, Mesa v3d-vc4, opengl es 2.0
When I try to run my qt qml application on this build, I'm getting this error:
QStandardPaths: wrong permission on runtime directory /usr/bin/, 7755 instead of 7700
drmModeGetResources failed (Operation not supported)
no screens available, assuming 24 -bit color
Cannot create window: no screens available.
Summary : I need to run my qt5 qml application on Rpi 4 with hw accelerated.
I found the solution.
I think the Rpi4 with eglfs using default card for card0, and this is not work. Need to force using card1 for eglfs.
Create a file "eglfs.json" with the following content:
{ "device": "/dev/dri/card1" }
export QT_QPA_EGLFS_KMS_CONFIG=/wherever/is/the/file/eglfs.json
and run your qt app!
Also my qt5 qml program is not showing fonts or text on rpi4 buildroot system. Coping /usr/share/fonts/your_program_fonts worked for me.
I have no idea why this is happening. But everytime I compile my application with a couple of the Qt versions that I have installed I now get these warnings:
In file included from /home/Qt5.9.2/5.9.2/gcc_64/include/QtGui/qbrush.h:50,
from /home/Qt5.9.2/5.9.2/gcc_64/include/QtGui/qpalette.h:46,
from /home/Qt5.9.2/5.9.2/gcc_64/include/QtWidgets/qwidget.h:48,
from /home/Qt5.9.2/5.9.2/gcc_64/include/QtWidgets/qdesktopwidget.h:44,
from /home/Qt5.9.2/5.9.2/gcc_64/include/QtWidgets/QDesktopWidget:1,
from ../src/../../CommonClasses/SQLConn/../../CommonClasses/common.h:6,
from ../src/../../CommonClasses/SQLConn/dbinterface.h:10,
from ../src/../../EyeExperimenter/src/sslclient/sslclient.h:10,
from ../src/../../EyeExperimenter/src/sslclient/ssldbclient.h:4,
from ../src/sslwrapper.h:6,
from ../src/main.cpp:3:
/home/Qt5.9.2/5.9.2/gcc_64/include/QtGui/qtransform.h: In member function ‘QTransform& QTransform::operator=(QTransform&&)’:
/home/Qt5.9.2/5.9.2/gcc_64/include/QtGui/qtransform.h:81:46: warning: ‘void* memcpy(void*, const void*, size_t)’ writing to an object of type ‘class QTransform’ with no trivial copy-assignment; use copy-assignment or copy-initialization instead [-Wclass-memaccess]
{ memcpy(this, &other, sizeof(QTransform)); return *this; }
^
/home/Qt5.9.2/5.9.2/gcc_64/include/QtGui/qtransform.h:57:20: note: ‘class QTransform’ declared here
class Q_GUI_EXPORT QTransform
Can any one tell me what this warning is and, more importantly, how do I get rid of it? From what I've seen it has to do with gcc8 which my system currently has, however I've tried chaging the compiler in the Qt Kits configuration of QtCreator and the warning still appears...
You use qmake as the build system generator, and then gnu make to actually build stuff - Qt Creator is just a shortcut from typing it all out on the command line :)
You can pass the relevant flag to the compiler by adding the following to your .pro file, then re-running qmake on the project (e.g. delete the build folder and build again):
QMAKE_CFLAGS_WARN_ON += -Wno-class-memaccess
QMAKE_CXXFLAGS_WARN_ON += -Wno-class-memaccess
QMAKE_CFLAGS += -Wno-class-memaccess
QMAKE_CXXFLAGS += -Wno-class-memaccess
My project is using both Qt (included Qwt) and Boost::signals. As known, their macros are incompatible with each other. I compiled my project with CONFIG += no_keywords and renamed all Qt macros with upper-case registry i.e. signals = Q_SIGNALS. There are no more errors in project, but now I have errors in Qwt includes like this
/usr/include/qwtplot3d/qwt3d_extglwidget.h:101:1: error: ‘signals’ does not name a type
/usr/include/qwtplot3d/qwt3d_extglwidget.h:116:8: error: expected ‘:’ before ‘slots’
/usr/include/qwtplot3d/qwt3d_extglwidget.h:116:8: error: ‘slots’ does not name a type
It seems that Qwt is still conflicting with Boost::signals. What can I do here?
Qwt is compatible with boost signals - you are talking about a lib called QwtPlot3D !
When you want to use boost signals with QwtPlot3D you have to patch its implementation replacing the signal/slot/emit macros like you did it with your code.
My standard CMakeLists.txt file for projects that use Qt looks like:
PROJECT(KFileWidgetDemo)
FIND_PACKAGE(Qt4 REQUIRED)
INCLUDE(${QT_USE_FILE})
QT4_WRAP_UI(UISrcs form.ui)
QT4_WRAP_CPP(MOCSrcs form.h)
include_directories(${include_directories} ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_BINARY_DIR})
ADD_EXECUTABLE(KFileWidgetDemo main.cpp form.h form.cpp ${MOCSrcs} ${UISrcs})
TARGET_LINK_LIBRARIES(KFileWidgetDemo ${QT_LIBRARIES})
However, I have always only used Q* classes. Now I need to use KFileWidget, and I am getting errors when compiling:
error: stray ‘\177’ in program
error: stray ‘\1’ in program
Is there a magic CMake command that might fix this?
Thanks,
David
I was under the impression the the K* classes were what Qt named their KDE specific subclasses. I guess that is not quite the case. I got this working by including and linking to KDE4 directly with:
cmake_minimum_required(VERSION 2.6)
PROJECT(KFileWidgetDemo)
FIND_PACKAGE(Qt4 REQUIRED)
INCLUDE(${QT_USE_FILE})
find_package(KDE4 4.5.0 REQUIRED)
include_directories( ${KDE4_INCLUDES} )
QT4_WRAP_UI(UISrcs form.ui)
QT4_WRAP_CPP(MOCSrcs form.h)
include_directories(${include_directories} ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_BINARY_DIR})
ADD_EXECUTABLE(KFileWidgetDemo main.cpp form.h form.cpp ${MOCSrcs} ${UISrcs})
TARGET_LINK_LIBRARIES(KFileWidgetDemo ${QT_LIBRARIES} ${KDE_LIBRARIES} ${KDE4_KDEUI_LIBS} ${KDE4_KFILE_LIBS})
Note the key to resolve the linker errors for KUrl was ${KDE4_KFILE_LIBS}.
I had a similar effect when one of my source files was converted to UTF-16 by some IDE. Check the encoding of your files and change them to UTF-8.