namespace "Ui" has no member "xxxxx"
-
Hello, first post on here and looking for some guidance. I am using Qt in VS2019. I am just making a wee test application to try and learn what I am doing and come across an error message. In the ItemAddDialog.h file I have a red error line under
private:
Ui::ItemAddDialog ui; //error under "ItemAddDialog"
The error message says "namespace "Ui" has no member "itemAddDialog".
These are the error messages when I run in VS.
1>C:\Users\gh185103\source\repos\QtStoreInvApp\QtStoreInvApp\itemadddialog.h(15,6): error C2039: 'ItemAddDialog': is not a member of 'Ui'
1>C:\Users\gh185103\source\repos\QtStoreInvApp\QtStoreInvApp\x64\Debug\uic\ui_itemadddialog.h(99): message : see declaration of 'Ui'
1>C:\Users\gh185103\source\repos\QtStoreInvApp\QtStoreInvApp\itemadddialog.h(15,20): error C2460: 'ItemAddDialog::ui': uses 'ItemAddDialog', which is being defined
1>C:\Users\gh185103\source\repos\QtStoreInvApp\QtStoreInvApp\itemadddialog.h(6): message : see declaration of 'ItemAddDialog'
Any help would be fantastic! Thanks
-
So look into the ui class and you will see that the compiler is correct.
-
Hi and welcome to the forums
But what is ItemAddDialog ?
Did you make a custom widget you called ItemAddDialog ?
it should generate a file called ui_ItemAddDialog.h ?
Do you use the plugin for Qt for Vs ?
-
ItemAddDialog is a Qt Widgets class so has an itemadddialog.cpp, itemadddialog.h & itemadddialog.ui.
I used the plugin for Qt for VS2019.
I can see a file called ui_ItemAddDialog.h in the x64 ->debug folder.
The code for the problamatic .h file is....
#pragma once
#include <QWidget>
#include "ui_itemadddialog.h"class ItemAddDialog : public QWidget
{
Q_OBJECTpublic:
ItemAddDialog(QWidget *parent = Q_NULLPTR);
~ItemAddDialog();private:
Ui::ItemAddDialog ui; //red error in ItemAddDialog
};Hope that can help you help me!
-
@aftershocker1 said in namespace "Ui" has no member "xxxxx":
#include "ui_itemadddialog.h"
Ui::ItemAddDialog ui; //red error in ItemAddDialog
So what is in
ui_itemadddialog.h
? It dsoes not sound like it definesUi::ItemAddDialog
. -
@mazen030 said in namespace "Ui" has no member "xxxxx":
I have same problem also hope that you can help
Then do what @JonB suggested...