I have the following `main.cpp` file:

#include <QApplication>
    #include "ui_checkabder.h"
    #include <QDialog>
    int main(int argc, char *argv[])
    {
    QApplication app(argc, argv);
    Ui::CheckAbder ui;
    QDialog *dialog = new QDialog;
    ui.setupUi(dialog);
    dialog->show();
    return app.exec();
    }

And, get the following errors when trying to run the program:

C:/Users/avbder/Desktop/abder/main.cpp:7: error: 'CheckAbder' is not a member of 'Ui'

    C:/Users/avbder/Desktop/abder/main.cpp:7: error: expected ';' before 'ui'

    C:/Users/avbder/Desktop/abder/main.cpp:7: error: expected ';' before 'ui'

    C:/Users/avbder/Desktop/abder/main.cpp:9: error: 'ui' was not declared in this scope

Any ideas on how to solve those problems?

Thanks.

Are you sure you've used the correct namespace in the declaration of the CheckAdber instance ui at line 7?
e.g.

Ui::CheckAdber ui;

From your error messages, it looks as if the Ui namespace does not exist.
And you should bear in mind that namespaces are case sensitive, so the compiler would see 'namespace Ui' as a completely different namespace to 'namespace UI'.

So you need to take a look at the file 'ui_checkadber.h' and see what namespace is being used to contain the CheckAdber class and use that instead. I suspect the namespace is probably called UI rather than Ui, so something like this will probably work:

UI::CheckAdber ui;

Cheers for now,
Jas.

This article has been dead for over six months. Start a new discussion instead.