qtqdebug

No such file or directory #include <QDebug>


Why I got an error:

I use Qt Creator. Version Qt 5.9.7 for Desktop

Output::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::

23:02:13: Uruchamianie "/usr/bin/make" 
g++ -c -pipe -g -std=gnu++11 -Wall -W -fPIC -DQT_QML_DEBUG -I../Kurs_STL_cpp0x -I. -I../../anaconda3/mkspecs/linux-g++ -o main.o ../Kurs_STL_cpp0x/main.cpp
../Kurs_STL_cpp0x/main.cpp:4:10: fatal error: Debug: No such file or directory
 #include <Debug>
          ^~~~~~~
compilation terminated.
Makefile:627: recipe for target 'main.o' failed
make: *** [main.o] Error 1
23:02:13: Proces "/usr/bin/make" zakończył się kodem wyjściowym 2.
Błąd budowania / instalowania projektu Kurs_STL_cpp0x (zestaw narzędzi: Desktop)
Podczas wykonywania kroku "Make"
23:02:13: Czas trwania: 00:00.

Solution

  • When you select a non-Qt project, the generated *.pro file is configured to disable Qt (and you will not be able to include Qt files).

    In *.pro file, remove the line CONFIG -= qt to enable Qt.

    After that, you may need to include the different Qt modules (widgets, quick, etc.) by adding them to the env variable QT (the module core and gui should be enabled by default).

    For example, to use the Qt Widgets and Qt Quick, you have to add QT += widgets quick

    You can also disable useless modules by adding a line like QT -= gui