Joshua
Joshua

Reputation: 4320

fatal error: QtGui/QApplication: No such file or directory|

First things first, yes I did do a thorough search of the dozens of like names posts and my solution was either not there or not apparent to my limited knowledge of the topic.

I am fairly proficient in C++, and use it often, but I have literally just discovered QT and decided to take a whack at it. The error is very basic, which I assume means I did something very basic incorrectly.

What I am using:

  1. Latest version of CodeBlocks
  2. Latest version of QT
  3. A piece of example code from this topic: (Display QImage with QtGui).
  4. Code blocks is installed here: C:\Program Files (x86)\CodeBlocks
  5. MinGW here: C:\MinGW\bin
  6. QT here: C:\Qt\4.8.5\bin

Here is my complete Environment path:

C:\Program Files (x86)\SSH Communications Security\SSH Secure Shell; C:\Qt\4.8.5\bin

From the post I referenced, it sounds like this is a complete and working program (I replaced the image with an image of my own), which further strengthens my opinion that I goofed in a small but profound way.

Referenced Code:

#include <QtGui/QApplication>
#include <QLabel>

int main(int argc, char *argv[])
{
    QApplication a(argc, argv);

    QImage myImage;
    myImage.load("test.png");

    QLabel myLabel;
    myLabel.setPixmap(QPixmap::fromImage(myImage));

    myLabel.show();

    return a.exec();
}

The full error log from CodeBlocks build and run:

C:\Users\Josh\Dropbox\Code\Cards\qtTest_loadololo.cpp|1|fatal error: QtGui/QApplication: No such file or directory|
||===

 Build finished: 1 errors, 0 warnings (0 minutes, 4 seconds) ===|

The full build log:

\Dropbox\Code\Cards\qtTest_loadololo.o
C:\Users\Josh\Dropbox\Code\Cards\qtTest_loadololo.cpp:1:30: fatal error: QtGui/QApplication: No such file or directory
compilation terminated.
Process terminated with status 1 (0 minutes, 4 seconds)
1 errors, 0 warnings (0 minutes, 4 seconds)

Please do not assume anything I did not provide, I am extremely new to installing all of this and will not take offense to even the simplest of questions.

Upvotes: 3

Views: 9938

Answers (2)

Peer Sommerlund
Peer Sommerlund

Reputation: 512

I had a similar issue when upgrading from Qt4 to Qt5. I know your path says Qt 4.8.5, but maybe you have multiple versions installed. Your post is dated 2013-07-09, and Qt 5.0 was released at 2012-12-09.

Try to take a look at http://qt-project.org/wiki/Transition_from_Qt_4.x_to_Qt5 - maybe it will help you. It did help me.

Upvotes: 0

erik
erik

Reputation: 2446

I had the same problem on Fedora Linux. I have solved it changing the import line to

#include <QApplication>

and instead of using qmake (which uses QT3) it had to use qmake-qt4 (for QT4).

Upvotes: 5

Related Questions