0

I was trying to compile gpsd package with arm-Linux-gnueabi-c++, here is line:

arm-linux-gnueabi-c++ -o qt-gpsutils.os -c -Os -Wextra -Wall -Wno- uninitialized
-Wno-missing-field-initializers -Wcast-align -Wmissing-declarations 
-Wpointer-arith -Wreturn-type -pthread -Wmissing-declarations -O2 -pthread
-fPIC -DUSE_QT -DQT_SHARED -I/usr/include/qt4 -I/usr/include/qt4/QtNetwork
-I/usr/include/qt4/QtCore gpsutils.c

gpsutils.c:26:21: fatal error: QDateTime: No such file or directory
#include <QDateTime>

compilation terminated.
scons: *** [qt-gpsutils.os] Error 1
scons: building terminated because of errors.

I checked my PC directory /usr/include/qt4/QtCore, it has QDatetime file, what is the problem.

Toby Speight
  • 27,591
  • 48
  • 66
  • 103
Lewis Liu
  • 67
  • 5
  • tried with #include "QDateTime.h" , same problem. – Lewis Liu Aug 05 '16 at 01:00
  • 2
    According to [this](https://doc.qt.io/qt-5/qdatetime.html), `#include ` is correct. Note the capital `T` in `Time`. – Keith Thompson Aug 05 '16 at 02:41
  • 2
    Sorry, after I voted to close I noticed that the error message refers to `QDateTime`, which is the correct spelling. But your title and the body of the question refer to `QDatetime`, which is incorrect. Please double-check the spelling and update the question to be consistent. – Keith Thompson Aug 05 '16 at 02:43
  • @pingul It is [conventional, and perhaps advantageous](http://stackoverflow.com/a/3162067/2757035), to use angled brackets when `#include`ing library headers. But more to the point, a quick glance at various API docs indicates that Qt does not use `.h` extensions. So, your suggestion is misguided. – underscore_d Aug 05 '16 at 10:12
  • Are you cross compiling? And trying to include non-sysroot headers? – peppe Aug 05 '16 at 10:19

1 Answers1

0

I had the same problem, for me commenting out a line in the generated .pro did the trick. I created a test project and there the line

CONFIG -= qt

removed all qt modules i added before (e.g. by writing QT += core). After commenting this line my problems went away. You could also write

CONFIG += qt

that would be the normal configuration line for QT projects i think.

Edit: Your output suggests that this config variable is already set and QTCore is added to the libraries that are linked. I use QT 5.10 and there the compilation flags/defines are named differently, so i am not shure what happened in your case.

Timobile
  • 21
  • 4