class Ui::MainWindow has no member named 'lineEdit'
-
wrote on 9 Apr 2022, 10:05 last edited by
-
i added some objects in mainwindow.ui
And got this error
This problem is only with new objects
There are no such problems with other projects, only with this onetried:
Rebuild
Reopening the project
Re-entry to QT
Deleting *.pro.userIt didn't help.
wrote on 9 Apr 2022, 12:09 last edited by@BITniki said in class Ui::MainWindow has no member named 'lineEdit':
This problem is only with new objects
There are no such problems with other projects, only with this oneI do not know why this is the case.
You presumably have verified that your
mainwindow.cpp
has#include "ui_mainwindow.h"
at the start?Make sure there is not some other
ui_mainwindow.h
lying around somewhere. You have discovered that lives in the build output directory. Make sure there isn't one in, say, the same source directory as yourmainwindow.cpp
.Delete all files in the build output directory (not your sources directory!). That should force a full rebuild.
Other than that I don't know.
-
i added some objects in mainwindow.ui
And got this error
This problem is only with new objects
There are no such problems with other projects, only with this onetried:
Rebuild
Reopening the project
Re-entry to QT
Deleting *.pro.userIt didn't help.
wrote on 9 Apr 2022, 10:12 last edited by JonB 4 Sept 2022, 10:13@BITniki
I can't tell from your screenshot, I assume you have verified thatQLineEdit's
name is spelledlE_Port
(first char lowercaseL
) and notIE_Port
(first char uppercaseI
)?Make sure your designer changes are being saved to the
.ui
file, and the build is re-running theuic
to process the.ui
file. That generates a file namedui_mainwindow.h
in the build output directory (for Debug or Release, where the.obj
files are generated when compiling). Read that in and look at it. You should see it change/be regenerated any time you build after altering anything in the designer. Is that happening? What does it have in its content relating tolE_Port
? -
@JonB
it's lowercaseL
inlE_Port
Sorry, I didn't quite understand you, but there my mainwindow.ui file
and my ui_mainwindow.h file
Alse, there my build settings
Hope thats helpwrote on 9 Apr 2022, 11:11 last edited by JonB 4 Sept 2022, 11:11@BITniki
The generated files seem to look good.This problem is only with new objects
What you show is a warning in the editor. This will happen when you add a new object in the designer but not yet rebuilt. Ignore it for now. If you actually build your project, does it compile successfully? If not show the compiler error output.
-
i added some objects in mainwindow.ui
And got this error
This problem is only with new objects
There are no such problems with other projects, only with this onetried:
Rebuild
Reopening the project
Re-entry to QT
Deleting *.pro.userIt didn't help.
wrote on 9 Apr 2022, 12:09 last edited by@BITniki said in class Ui::MainWindow has no member named 'lineEdit':
This problem is only with new objects
There are no such problems with other projects, only with this oneI do not know why this is the case.
You presumably have verified that your
mainwindow.cpp
has#include "ui_mainwindow.h"
at the start?Make sure there is not some other
ui_mainwindow.h
lying around somewhere. You have discovered that lives in the build output directory. Make sure there isn't one in, say, the same source directory as yourmainwindow.cpp
.Delete all files in the build output directory (not your sources directory!). That should force a full rebuild.
Other than that I don't know.
-
@JonB
Thanks.
I fixed the problem.
In the folder with the project, there was another ui_mainwindow.h
I don't understand how it got there, but thank you -
@BITniki , we need to rename a name_of_project.pro.user to name_of_project.pro.user.backup