No member named 'stackedWidget' in Ui::MainWindow
-
MainWindow is defined as follows:
MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent) , ui(new Ui::MainWindow) { ui->setupUi(this); } MainWindow::~MainWindow() { delete ui; } void MainWindow::on_login_button_clicked() { ui->stackedWidget->setCurrentIndex(1); }
This is the error message:
mainwindow.cpp:21: error: no member named 'stackedWidget' in 'Ui::MainWindow'The following are warning messages:
:-1: warning: Project WARNING: Qt has only been tested with version 10.15 of the platform SDK, you're using 11.1.
:-1: warning: Project WARNING: This is an unsupported configuration. You may experience build issues, and by using
:-1: warning: Project WARNING: the 11.1 SDK you are opting in to new features that Qt has not been prepared for.
:-1: warning: Project WARNING: Please downgrade the SDK you use to build your app to version 10.15, or configure
:-1: warning: Project WARNING: with CONFIG+=sdk_no_version_check when running qmake to silence this warning.
:-1: warning: "/Library/Developer/CommandLineTools/usr/bin/clang" is used by qmake, but "/usr/bin/clang" is configured in the kit.
Please update your kit (Desktop Qt 5.15.2 clang 64bit) or choose a mkspec for qmake that matches your target environment better.
:-1: warning: "/Library/Developer/CommandLineTools/usr/bin/clang++" is used by qmake, but "/usr/bin/clang++" is configured in the kit.
Please update your kit (Desktop Qt 5.15.2 clang 64bit) or choose a mkspec for qmake that matches your target environment better.The solution I found on other forums was to clean the project, rebuild the qmake, the run in debug, this did not help.
Thank you,
Arjun -
When the compiler says there there is no such member then I would guess it's right. Make sure that you really have such a widget in your ui file and that the ui_mainwindow.h is regenerated afterwards (delete it to be sure)
-
Hi
Also check that none of the build files ended up in the project folder.Did you try one of Creators' examples ? Can they run ?
Seems you are on macOS and using another Xcode/sdk than
expected ? -
@Christian-Ehrlicher My apologies, I did not fully understand your answer.
Is this what you mean by have such a widget? And what do you mean regenerate the ui_mainwindow.h? -
@arjun98
Hi- what do you mean regenerate the ui_mainwindow.h?
Delete any ui_xxx files in build folder (or just all files)
make sure no ui_xxx files are in the project folder.
Then run qmake from build menuAnd then check file been recreated.
-
@Christian-Ehrlicher Thank you, I had a typo in the widget name in the ui file which I was able to find in the ui_mainwindow.h file.