Qtdialog.cpp:3:24: fatal error: QApplication: file not found

I have downloaded UE4 from git, so it should be up to date.
I run Setup.sh on a Debian Wheezy with QT 4 installed and get:

building LinuxNativeDialogs
+ cd Source/ThirdParty/LinuxNativeDialogs/UELinuxNativeDialogs
+ rm -rf build
+ mkdir build
+ cd build
+ cmake ..
-- The C compiler identification is GNU 4.9.2
-- The CXX compiler identification is GNU 4.9.2
-- Check for working C compiler: /usr/bin/gcc
-- Check for working C compiler: /usr/bin/gcc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working CXX compiler: /usr/bin/c++
-- Check for working CXX compiler: /usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Found PkgConfig: /usr/bin/pkg-config (found version "0.26") 
-- Looking for Q_WS_X11
-- Looking for Q_WS_X11 - found
-- Looking for Q_WS_WIN
-- Looking for Q_WS_WIN - not found.
-- Looking for Q_WS_QWS
-- Looking for Q_WS_QWS - not found.
-- Looking for Q_WS_MAC
-- Looking for Q_WS_MAC - not found.
-- Found Freetype: /usr/lib/x86_64-linux-gnu/libfreetype.so (found version "2.4.9") 
-- Some or all of the gtk libraries were not found. (missing:  GTK2_GTK_LIBRARY GTK2_GTK_INCLUDE_DIR         GTK2_GDK_INCLUDE_DIR GTK2_GDKCONFIG_INCLUDE_DIR GTK2_GDK_LIBRARY) 
-- checking for module 'gtk+-3.0'
--   found gtk+-3.0, version 3.14.5
-- Qt4 found
-- GTK3 found
-- Configuring done
-- Generating done
-- Build files have been written to: /mnt/storage/jarvis/newgen/ue4/UnrealEngine_from_git/Engine/Source/ThirdParty        /LinuxNativeDialogs/UELinuxNativeDialogs/build
+ make -j4
Scanning dependencies of target qt4dialog
[ 25%] Building CXX object CMakeFiles/qt4dialog.dir/src/qtdialog.cpp.o
Scanning dependencies of target gtk3dialog
/<snip>/UnrealEngine_from_git/Engine/Source/ThirdParty/LinuxNativeDialogs    /UELinuxNativeDialogs/src/qtdialog.cpp:3:24: fatal error: QApplication: File not found
#include <QApplication>
                    ^
compilation terminated.

It looks to me like the Makefile is broken. My own program uses also QApplication and finds the dependency.
Is it possible that QT is installed in the wrong directory?

I have found:

 http://stackoverflow.com/questions/8995399/error-qapplication-no-such-file-or-directory 

in

https://answers.unrealengine.com/questions/131817/generateprojectfilessh-fail-on-debian.html

But this looks to me like the make file is not able to find QT4. So obviously, something in the makefile is broken, since Setup.sh finds qt4.

Hi thecr3w

I can’t really confirm that the Makefile is broken as everyone else, including myself, have compiled LND without any issues. Actually I use LND with qt4 and have never had a problem compiling it (I just synced with my repo and recompiled it without errors).

The only time problems arise is due to missing dependencies in the system, or some other reasons like missing compilers.

From what you have posted I see it’s trying to compile both GTK and Qt version, and you really need to just one. Try editing the CMakeLists.txt and comment out the other GTK/Qt options or just remove GTK headers from the system.

Else, check if perhaps some dependent Qt files are missing in your system. Debian should really work out of the box, as I use Ubuntu here and it’s really a problem-free “ride.”

Hi

I had the same problem yesterday, but to me tried to compile GTK, Qt4 and Qt5 versions. Could be any problem choosing the right version if there are some frameworks installed at the same time?

Generally there should not be any issues, but as I noted above, best bet is to try and comment out searching of other frameworks in the CMakeLists.txt file and just leave the one you wish to use.

Ok. That worked well, thank you!

i ran:
apt-get remove libgtk-3-dev && setup.sh

Result:

-- Check for working CXX compiler: /usr/bin/c++
-- Check for working CXX compiler: /usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Found PkgConfig: /usr/bin/pkg-config (found version "0.26") 
-- Looking for Q_WS_X11
-- Looking for Q_WS_X11 - found
-- Looking for Q_WS_WIN
-- Looking for Q_WS_WIN - not found.
-- Looking for Q_WS_QWS
-- Looking for Q_WS_QWS - not found.
-- Looking for Q_WS_MAC
-- Looking for Q_WS_MAC - not found.
-- Found Freetype: /usr/lib/x86_64-linux-gnu/libfreetype.so (found version "2.4.9") 
-- Some or all of the gtk libraries were not found. (missing:  GTK2_GTK_LIBRARY GTK2_GTK_INCLUDE_DIR         GTK2_GDK_INCLUDE_DIR GTK2_GDKCONFIG_INCLUDE_DIR GTK2_GDK_LIBRARY) 
-- checking for module 'gtk+-3.0'
--   package 'gtk+-3.0' not found
-- Qt4 found
-- Configuring done
-- Generating done
-- Build files have been written to: /<...snip...>/UnrealEngine-release/Engine/Source/ThirdParty    /LinuxNativeDialogs/UELinuxNativeDialogs/build
+ make -j4
Scanning dependencies of target qt4dialog
[ 50%] Building CXX object CMakeFiles/qt4dialog.dir/src/qtdialog.cpp.o
/<...snip...>/UnrealEngine-release/Engine/Source/ThirdParty/LinuxNativeDialogs/UELinuxNativeDialogs/src/qtdialog.cpp:3:24: fatal error: QApplication: Datei oder Verzeichnis nicht gefunden
 #include <QApplication>
                    ^
compilation terminated.

Guess what. Gtk not found. Qt4 found. Compile fails. As I said. My Cmake for my project successfully finds QT. Unreal does not. I use a standard, DEFAULT, debian installation with qt4 installed via apt-get. Nothing custom. (otherwise, my program would fail due to dependencies.)

Lets turn this around: where does UE4 search for “QApplication” ? And how?

locate QApplication resulted on my i386 ubuntu to:

/usr/include/qt4/QtGui/QApplication

The same is true for my Debian. Btw. this QApplication is just a bloating placeholder for qapplication.h in

/usr/include/qt4/Qt/qapplication.h
/usr/include/qt4/QtGui/qapplication.h

Both are the same files. Qt4 installation seems pretty chaotic to me.

Ok, I tracked it down to :

UnrealEngine-release/Engine/Source/ThirdParty/LinuxNativeDialogs/UELinuxNativeDialogs/build/CMakeFiles/qt4dialog.dir/depend.make

This file only include:

  • CMakeFiles/qt4dialog.dir/src/qtdialog.cpp.o:
    …/include/UNativeDialogs.h
  • CMakeFiles/qt4dialog.dir/src/qtdialog.cpp.o:
    …/src/qtdialog.cpp

Can anyone else with a working Setup.sh post hist depend.make?

Hi thecr3w,

Here is mine, and it seems you are missing all the Qt includes…

I agree. For unknown reason, Setup.sh detects that all Qt4 dependencies are in place, but CMake fails to include them. Weird. I have no skills with Cmake. I hope someone can direct me how to fix this. Otherwise, I will have to finally abandon UE4…

Well, i can’t troubleshoot your local installation. That’s something you need to take care of yourself…

Perhaps check if you have libqtgui4 installed? (that’s where QApplication lives)

I do not expect to get my local installation troubleshooted. My installation is fine (including libqtgui4). My application compiles without problem. Only UE4 fails. I am trying to troubleshoot the broken Cmake/Setup.sh of UE4, which is not including QT altough it detects it’s presense. You have to agree that the installation behaves strange at that point… without any error or warning…

Furthermore, my “depend.internal” seems also to be incomplete:

CMAKE generated file: DO NOT EDIT!
Generated by "Unix Makefiles" Generator, CMake Version 2.8

CMakeFiles/qt4dialog.dir/src/qtdialog.cpp.o
 ../include/UNativeDialogs.h
 /mnt/storage/jarvis/newgen/ue4/UnrealEngine-release/Engine/Source/ThirdParty/LinuxNativeDialogs/UELinuxNativeDialogs/src/qtdialog.cpp

Finally: in a previous comment of yours, you suggested to comment the framework search for gtk in CmakeLists.txt. Could you be more precise?

Which of the 29 CmakeLists.txt files?
Which line to comment?

Hi,

Assuming you are using 3dluvr/4.7-linux, lines 6-9 in CMakeLists.txt are responsible for searching for various frameworks.

Just add # sign infront of the ones you want commented out, so to use Qt4, lines 7, 8 and 9 should be commented out.

@ amigo: there are several CmakeLists.txt. Not of them matches any framework search in line 6-9. sorry.

Finally, I installed a current ubuntu on one of our game servers. Installed unreal engine from 3dluvr.
Result:
Installation works
Compiling all (including UE4Editor) works
./UE3Editor
Error in ./UE4Editor: malloc(): memory corruption: 0x00000000944ba20

After a lot of trial and error on redhat, debian and now finally ubuntu, I realize that Unreal is not ready (and propably never will be) for a migration of our project to linux. Very, very sad. But I give up. 1.5 months is to long to get a game engine running while explaining the project owner these… childish… bugs. Keep focusing on windows and osx. Stop developing for linux. Many will benefit if they do not have to spend productive time with this nonsense.

Hi thecr3w,

I’m sorry you feel that way and have spent so much time trying to get the Editor running. You could be one of the edge cases, or perhaps having issues totally unrelated to UE4 itself.

All I can’t tell you is that everyone I have spoken to has been able to successfully compile and run the 3dluvr/4.7-linux in Linux (Ubuntu, Mint, Gentoo, Fedora, Arch, Suse, etc) either by following the Wiki or getting help on the IRC when Wiki wasn’t enough.

The only suggestion I have is to try again on a clean Ubuntu 14.04 LTS, following the Wiki exactly step-by-step. Alternatively you may wait for Epic to release a binary version of the UE4 Editor for Linux.

Thanks.

@anonymous_user_e638ad1f it’s sad to see you go. As for your trial and error: if you want to develop UE4 on Linux, your best bet is (latest) Ubuntu and binary NVidia drivers. Also note that you don’t have to have the editor in order to “get the engine running”, you can cross-compile your Linux game.