Unsolved The problem is that you can't find the header file starting with ui.
-
#pragma once #include <QWidget> #include "ui_WTest.h" class WTest : public QWidget { Q_OBJECT public: WTest(QWidget *parent = Q_NULLPTR); ~WTest(); private: Ui::WTest ui; };
"The current source file is not in the directory or build system path."
I'm developing in vs2019, and I clicked go to the ui_WTest.h file to see the ui file, but it says it can't find the path, but it builds normally? How can we solve this problem?
I can't proceed with development because I can't access it from cpp to the ui control itself.
I created a new project in qt creator, but I can't find a path for this either. -
That file is generated from the corresponding WTest.ui file that should be listed in the PRO file FORMS variable.
-
Why can't I find a path when it's easy to create?
-
@IknowQT said in The problem is that you can't find the header file starting with ui.:
Why can't I find a path when it's easy to create?
Again: ui_WTest.h will be generated when you build your app, before you build it does NOT exist!
Did you do what @ChrisW67 suggested? "hat file is generated from the corresponding WTest.ui file that should be listed in the PRO file FORMS variable" - so, is WTest.ui in your pro file in the FORMS variable? -
# ---------------------------------------------------- # This file is generated by the Qt Visual Studio Tools. # ------------------------------------------------------ # This is a reminder that you are using a generated .pro file. # Remove it when you are finished editing this file. message("You are running qmake on a generated .pro file. This may not work!") HEADERS += ./MainWidget.h \ ./WTest.h \ ./WLogin.h SOURCES += ./MainWidget.cpp \ ./main.cpp \ ./WLogin.cpp \ ./WTest.cpp FORMS += ./MainWidget.ui \ ./WLogin.ui \ ./WTest.ui RESOURCES += MainWidget.qrc
I checked that it is in the path and if I build with debug, I also checked that it is created in x64\debug\uic, but the same message still appears.
-
@IknowQT Why do you have ./ in front of every file you add to your project?
-
Is there any reason the path is different in front?
Even when I try to create a new project, I get the same error. -
@IknowQT said in The problem is that you can't find the header file starting with ui.:
Is there any reason the path is different in front?
I don't know what this means.
"Even when I try to create a new project, I get the same error" - what type of project do you create? Create a widgets project - that one should work and you also can see how pro file should look like.
-
It means there is something wrong with my widget project path, so I created a new project, but the same problem occurs.
The newly created project path is the same. -
@IknowQT
make sure your project path has no special characters in it, no whitespaces no unicode etc. -
What I really don't understand is that MainWidget.ui and WLogin.ui files are accessible? Why is it only like Test, which is the same condition?
-
@IknowQT how did you create your WTest class, I don't think you used the wizard, because it has non default stuff in it like
#pragma once
and missingexplicit
keyword for the constructor.
are you sure the (raw)ui file actually exists ? -
I checked that it was created in the x64\debug\uic path, only Wtest can't access it...
-
@IknowQT
WTest.ui has the path x64\debug\uic\WTest.ui ?because thats not the one you specified in the project file
-
@J-Hilk
Exactly ui_WTest.h.
In that path, the files that I said were accessible are also in the same path.