QApplication: there is no such file or directory with Qt5 and qtsingleapplication on windows

It’s hard for me to compile windows since I am switching to QT 5.0.1 (from http://qt-project.org/downloads ) and the qtsingleapplication module (latest version from http://qt.gitorious.org/qt-solutions ).

On Linux, compilation still works (Qt 4.8.2)

I do not understand why. This is a detailed output from qtcreator.

09:57:58: Exécution des étapes pour le projet Wahoo ...
09:57:58: Inch configuration, étape QMake sautée.
09:57:58: Débute: "D: \ Qt \ Qt5.0.1 \ Tools \ MinGW \ bin \ mingw32-make.exe"

D: /Qt/Qt5.0.1/Tools/MinGW/bin/mingw32-make -f Makefile.Release
mingw32-make [1]: Enter the directory 'C: / Documents and Settings / crazy / Bureau / Kowmedia.Wahoo / src / Build-Release / release'

g ++ -c -pipe -fno-keep-row dllexport -O2 -frtti -Wall -Wextra -fexceptions -mthreads -DUNICODE -DQT_NO_DEBUG -DQT_WEBKIT_LIB -DQT_WIDGETS_LIB -DQT_XML_LIB -DQT_NETWORK_LIB -DQT_GUI_LIB -DQT_CORE_LIB -DQT_OPENGL_ES_2 -DQT_OPENGL_ES_2_ANGLE -DQT_NEEDS_QMAIN -I .... \ wahoo -I ".... \ wahoo \ qtsingleapplication \ src" -I "D: \ Qt \ Qt5.0.1 \ 5.0.1 \ mingw47_32 \ include" -I "D: \ Qt \ Qt5. 0.1 \ 5.0.1 \ mingw47_32 \ include \ QtWebKit "-I" D: \ Qt \ Qt5.0.1 \ 5.0.1 \ mingw47_32 \ include \ QtWidgets "-I" D: \ Qt \ Qt5.0.1 \ 5.0. 1 \ mingw47_32 \ include \ QtXml "-I" D: \ Qt \ Qt5.0.1 \ 5.0.1 \ mingw47_32 \ include \ QtNetwork "-I" D: \ Qt \ Qt5.0.1 \ 5.0.1 \ mingw47_32 \ include \ QtGui " -I "D: \ Qt \ Qt5.0.1 \ 5.0.1 \ mingw47_32 \ include \ QtCore" -I "release" -I "." -I AM "." -I "D: \ Qt \ Qt5.0.1 \ 5.0.1 \ mingw47_32 \ mkspecs \ win32-g ++" -o release \ qtsingleapplication.o .... \ wahoo \ qtsingleapplication \ src \ qtsingleapplication.cpp

g ++ -pipe -fno-keep-row dllexport -O2 -frtti -Wall -Wextra -fexceptions -mthreads -DUNICODE -DQT_NO_DEBUG -DQT_WEBKIT_LIB -DQT_WIDGETS_LIB -DQT_XML_LIB -DQT_NETWORK_LIB -DQT_GUI_LIB -DQT_CORE_LIB -DQT_OPENGL_ES_2 -DQT_OPENGL_ES_2_ANGLE -DQT_NEEDS_QMAIN ../. ./wahoo/qtsingleapplication/src/qtsingleapplication.cpp -o ../../ wahoo / qtsingleapplication / src / QtSingleApplication

Included in the file from .. /../wahoo/qtsingleapplication/src/qtsingleapplication.cpp:42:07:
../../wahoo/qtsingleapplication/src/qtsingleapplication.h:44:24: fatal error: QApplication: no such file or directory

compilation completed.

<builtin>: recipe for target '../../wahoo/qtsingleapplication/src/QtSingleApplication' failed
mingw32-make [1]: ** [../../wahoo/qtsingleapplication/src/QtSingleApplication] Error 1
mingw32-make [1]: leave the folder "C: / Documents and Settings / crazy / Bureau / Kowmedia.Wahoo / src / Build-Release / release"
makefile: 34: recipe for target release failed
mingw32-make: ** [release] Error 2
09:57:59: Le processus "D: \ Qt \ Qt5.0.1 \ Tools \ MinGW \ bin \ mingw32-make.exe" s'est terminé avec le code 2.
Error creating / deploying a Wahoo project (bundle: Qt 5.0.1 MinGW 32bit desktop) Lors de l'exécution de l'étape Make

Each file is an option -I "D: \ Qt \ Qt5.0.1 \ 5.0.1 \ mingw47_32 \ include \ QtWidgets" too. QtCreator can find the file if I view the source code. So I lost a little ...

Thank you in advance

+4
source share
4 answers

... QApplication: There is no such file or directory ...

try to add

QT += widgets 

in your .pro file. I had the same message ... It seems that out of 5.0 Qt-based applications, widgets do not like by default ... Did everyone move to QML?

PS: now, as the next item in this quest, I have QPrinter, so as not to find it)

+12
source

This assumes that you have incorrectly configured library search paths in your IDE. QT SDK libraries not found. Did you install everything with the QT tools and / or the installation guide?

"QApplication" is one of the header files included by #include <qapplication> . Depending on how and which SDK you installed, it may be, for example:

Nokia SDK with carbide / Eclipse:

 C:\????\Nokia\devices\Nokia_Symbian_Belle_SDK_v1.0\epoc32\include\mw\qtgui 

QtCreator Installer and QT SDK:

 C:\????\QtSDK\Symbian\SDKs\SymbianSR1Qt474\include\QtGui 

Where???? indicates the location that you selected when installing the tools. First check if you have a file.

You have this, and if it is not damaged, and if you are not mistaken in the driver, etc., then check your QT project files and see if you really have all the imports and includes the correct set. Maybe you forgot some kind of suffix "\ include", or maybe you have too much? LINUX and WIN32 configurations usually differ in many settings, it is very easy to randomly mix some conventions that set the paths

EDIT:

Thanks for the update! Paths really look ok

I re-read your error log and everything looked great until I formatted it a bit. Something strange came out. Look at the first g ++ call and compare it to the second, which does not work.

The second does not have all the path settings. But it normal. The first is compiling, the second is linking. It differs by the parameter g++ -c versus g++ wihtout "-c". But look, the FILES are transferred to g ++.

The first compiles qtsingleapplication.cpp to qtsingleapplication.o , and the second tries to associate qtsingleapplication.cpp with -o QtSingleApplication .

I think that:

  • or the second line forgot the "-c" parameter and all the paths -I
  • or the second line has an invalid input file and should have qtsingleapplication.o instead of .cpp

I assume that you really have some switches / conditional errors in your qtprojs for the following cases: win32. Sorry, I can’t tell you anymore, at the moment I’ll have to try to compile a project myself and examine the / qtprojs make files. Try backtracking on how the second line is generated and which makefile / qtproj variables are used, and then double or even triple check your project settings. Do this not in the IDE, but in the actual project files that are used. The IDE sometimes hides some conditions and settings from you, especially QT Creator likes to do this.

0
source

I also ran into this problem.

As soon as i added

 QT += widgets 

as Denjs suggested, I also needed to add:

 INCLUDEPATH += $$PWD/../qtsingleapplication-2.6-opensource/src/ 

What is the location of the QtSingleApplication source files.

0
source

I am new to Qt. And when I try the first program, after qmake -project qmake hello.pro

an error occurred after "make": 'QApplication'file not found

but with the same code, it can successfully debug Qt Creator. the same error occurred when I want to free her.

The solution is to modify the .pro file. Add the following two lines:

QT + = core gui

moreThan (QT_MAJOR_VERSION, 4): QT + = widgets

0
source

All Articles