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;
    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?


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

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,

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.