[Solved]No such file or directory error



  • Sirs
    I have recently upgraded my OS from Ubuntu 10.04 to Mint 15 and attempting to recompile my existing code.
    I have a program that compiled before and now fails with a No such file or directory error.
    My pro file looks like this:
    @
    TARGET = inputDialogue
    TEMPLATE = lib
    QT += widgets
    DEFINES += INPUTDIALOGUE_LIBRARY

    SOURCES += inputdialogue.cpp

    HEADERS += inputdialogue.h
    inputDialogue_global.h
    @

    inputdialog.h looks like this:
    @
    #ifndef INPUTDIALOGUE_H
    #define INPUTDIALOGUE_H

    #include "inputDialogue_global.h"
    #include <QApplication>
    #include <QtWidgets>
    #include </usr/include/qt4/QtGui/QtGui>
    #include </usr/include/qt4/QtGui/QMessageBox>
    #include </usr/include/qt4/QtGui/QInputDialog>
    //
    enum SEVERITY { QUESTION, INFORMATION, WARNING, CRITICAL};

    class INPUTDIALOGUESHARED_EXPORT InputDialogue {
    public:
    InputDialogue();

    QString getError(void) { return errorMsg; }
    void setError(QString txt) { errorMsg = txt; }

    QString getLabelText(void) { return Label; }
    void setLabelText(QString txt) { Label = txt; }

    int getResponse(void) { return response; }
    void setResponse(int res) { response = res; }

    void test(int);

    private:
    QString Label;
    QString errorMsg;
    int response;
    };

    #endif // INPUTDIALOGUE_H
    @

    inputDialogue_global.h like this:

    @
    #ifndef INPUTDIALOGUE_GLOBAL_H
    #define INPUTDIALOGUE_GLOBAL_H

    #include <QtCore/qglobal.h>

    #if defined(INPUTDIALOGUE_LIBRARY)

    define INPUTDIALOGUESHARED_EXPORT Q_DECL_EXPORT

    #else

    define INPUTDIALOGUESHARED_EXPORT Q_DECL_IMPORT

    #endif

    #endif // INPUTDIALOGUE_GLOBAL_

    @

    inputdialogue.cpp like this:

    @
    #include "inputdialogue.h"

    InputDialogue::InputDialogue()
    {
    }

    //InputDialogue INPUTDIALOGUESHARED_EXPORT inputdialog;

    void InputDialogue::test(int mode)
    {
    QString title;
    QMessageBox msgBox;
    int ret;

    title = getLabelText();
    errorMsg = getError();

    setResponse(NULL);
    msgBox.setText(title);
    msgBox.setInformativeText(errorMsg);
    switch (mode)
    {
    //case information:
    case INFORMATION:
    msgBox.setIcon(QMessageBox::Information);
    msgBox.setStandardButtons(QMessageBox::Ok );
    msgBox.setDefaultButton(QMessageBox::Ok);
    ret = msgBox.exec();
    setResponse(0);
    break;

    //case warning:
    case WARNING:
    msgBox.setIcon(QMessageBox::Warning);
    msgBox.setStandardButtons(QMessageBox::Ok | QMessageBox::Cancel);
    msgBox.setDefaultButton(QMessageBox::Ok);
    switch (msgBox.exec())
    {
    case QMessageBox::Ok:
    setResponse(0);
    break;
    case QMessageBox::Cancel:
    setResponse(2);
    break;
    }
    break;

    //case critical:
    case CRITICAL:
    msgBox.setIcon(QMessageBox::Critical);
    msgBox.setStandardButtons(QMessageBox::Ok );
    msgBox.setDefaultButton(QMessageBox::Ok);
    ret = msgBox.exec();
    setResponse(0);
    break;

    //case question:
    case QUESTION:
    msgBox.setIcon(QMessageBox::Question);
    msgBox.setStandardButtons(QMessageBox::Yes | QMessageBox::No | QMessageBox::Cancel);
    msgBox.setDefaultButton(QMessageBox::Ok);
    switch (msgBox.exec())
    {
    case QMessageBox::Ok:
    setResponse(0);
    break;
    case QMessageBox::No:
    setResponse(1);
    break;
    case QMessageBox::Cancel:
    setResponse(2);
    break;
    }
    break;
    }
    }
    @
    Any information would be greatfully received.
    Thank you in anticipation.
    Graham B


  • Lifetime Qt Champion

    Hi and welcome to devnet,

    You have to give more information about your error. "No such file or directory" alone doesn't really help, what can't it find ? Which version of Qt are you using ?



  • Hi SGaist
    Thank you for your response.
    On compiling I get the following error message:
    @
    /usr/include/qt4/QtGui/qinputcontext.h:64: error: QtGui/qaction.h: No such file or directory
    @
    Both these header files do exist in the includes directory.
    I am using Qt4.
    I note from other answers to this question that QT += widget should be included in the pro file, which I have done.
    I originally created this program in February on ubuntu 10.04 without a problem.
    Is there something I'm missing here?


  • Lifetime Qt Champion

    It should be included for Qt 5 project and should give you an error currently if you are using Qt 4.

    So are you sure you are using the correct qmake ?



  • It would appear that I am using qt5.
    I have decided to start from scratch with an empty project and copy/paste chunks of code and recompile. Probably the easest way.
    Thank you for all your help.
    Graham B


  • Lifetime Qt Champion

    You're welcome,

    If you have it working now, please update the thread title prepending [solved] so other forum users may know a solution has been found :)


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.