0

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"
  1. QApplication file content is too short. Also it seems like I cannot find qapplication.h on the file system, is that normal?
  2. 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

Boris Mocialov
  • 3,439
  • 2
  • 28
  • 55

1 Answers1

1

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
FabienRohrer
  • 1,794
  • 2
  • 15
  • 26