Qt Creator - QApplication: No such file or directory
-
wrote on 16 Oct 2015, 14:46 last edited by Radim
Hi,
I successfully configured Qt Creator for cross-compilation and remote debugging. I'm using Qt 4.8.3.
Everything works perfectly except in the code editor the #include <QApplication> (and all Qt headers) is underlined and I get no assistance when writing code.
In what directories is the Qt Creator looking for the headers?
Note: I have a device specific qmake.conf, that uses an environmental variable that contains a sysroot path to configure include and lib paths. For compilation I set the variable in Build Environment in Projects settings.
-
Hi,
I successfully configured Qt Creator for cross-compilation and remote debugging. I'm using Qt 4.8.3.
Everything works perfectly except in the code editor the #include <QApplication> (and all Qt headers) is underlined and I get no assistance when writing code.
In what directories is the Qt Creator looking for the headers?
Note: I have a device specific qmake.conf, that uses an environmental variable that contains a sysroot path to configure include and lib paths. For compilation I set the variable in Build Environment in Projects settings.
wrote on 17 Oct 2015, 13:09 last edited byHi,
In your .pro add following lines.QT += core gui greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
In your main.cpp replace #include <QApplication> with
<QtGui/QApplication>
-
@Ratzz
QApplication is a widgets module class in Qt 5. To be compatible with both Qt 4 and 5 the include statement should not include the module. -
Hi,
In your .pro add following lines.QT += core gui greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
In your main.cpp replace #include <QApplication> with
<QtGui/QApplication>
wrote on 19 Oct 2015, 08:55 last edited by Radim@Ratzz I changed the #include but the include is still underlined and I get no hints in the editor :-( It seems the the Qt Creator has problem finding the file, whilst make works.
Please note, that the project compiles correctly with both <QApplication> and <QtGui/QApplication>
Edit: It works if I clear the sysroot path in the Kit. So obviously the Qt Creator uses the sysroot path to scan for header files. If I leave it empty, the Qt Creator however uses the header files of host and not target, which is wrong. I tried to put the header files to <sysroot>/usr/include/qt4, but it still does not work.
-
Which version of Qt Creator are we talking about ?
-
You should consider updating Qt Creator. Current version is 3.5.1
-
wrote on 21 Oct 2015, 10:28 last edited by
I know. Only this version is provided for Ubuntu 14.04. Maybe I could install Qt 5.5 next to current installation in order not to corrupt current Qt, which is used by Ubuntu itself. Btw, do you think the 3.5 solves it or it is just to try? Better than trying different versions I would like to know, where the Qt Creator is looking for the header files.
-
That you can check in the Kit and Qt Versions for that information
-
wrote on 22 Oct 2015, 06:32 last edited by
I know, but I need to know, where exactly. For example in the kit I have sysroot /<some path>. So in what directories the Qt Creator is looking? Is it /<some path>/usr/include/qt or /<some path>/usr/include/qt4 or different one. Btw I tried to put the Qt headers in these both directories and it didn't work. So where to put the Qt header files in the sysroot folder in order the Qt Creator finds them?
-
AFAIK, it should use the prefix set at compilation time to search that