QT创建者:如何打开现有项目?
首先,如果我的问题很愚蠢,我深表歉意。尽管看起来很容易,但我找不到解决方案。
我是QT创作者的新手。我将其安装在Linux上。每当我想打开一个现有项目时,我都会很难。因此,当我从“欢迎”选项卡中选择一个现有项目时,显示了最近创建的项目的列表。从此列表中选择很简单。当我查看路径时,它像.../project_folder/file.pro时,选择后者时,在“编辑”选项卡中,我将拥有如图1所述的内容,我可以访问main.cpp文件。并编辑它:
但是,当未列出项目并且必须单击“打开project”并浏览project_folder中的pro.pro时,它要求我“配置项目”和“导入现有构建” 。我知道相对于Project_Folder的构建文件夹位于../build_folder中。我手动添加这条路。现在,在“编辑”选项卡中,我只有一个只有.pro文件的文件夹。因此,无法访问main.cpp。如图2所示,其中第二个项目是helloworld:
现在,问题是如何以我可以编辑的方式打开现有项目。我知道这应该非常简单,但是我无法弄清楚。
PS:这是helloworld.pro的内容
TEMPLATE = app
CONFIG += console c++17
CONFIG -= app_bundle
CONFIG -= qt
SOURCES += \
main.cpp
First of all, I apologize if my question is stupid. Although it seems easy, I cannot find a solution.
I am a newbie to Qt creator. I installed it on Linux. And every time I want to open an existing project, I have difficulty. So, when I choose an existing project from the welcome tab, a list of recently created projects is shown. Choosing from this list is straightforward. And when I look at paths, it is something like .../Project_folder/file.pro when the latter is chosen, in the edit tab I will have something as described in Figure 1 where I can have access to the main.cpp file and edit it:
However, when the project is not listed and I must click on "open project" and browse file.pro from the Project_folder, it asks me to "configure project" and "import existing build". I know the build folder with respect to Project_folder is located in ../build_folder. I add manually this path. Now in the edit tab, I have a folder with only the .pro file. So, no access to main.cpp. This is shown in Figure 2 where the second project is HelloWorld:
Now, the question is how to open an existing project in a way that I can edit it. I know it should be very simple, but I can not figure it out.
P.S.: This is the content of HelloWorld.pro
TEMPLATE = app
CONFIG += console c++17
CONFIG -= app_bundle
CONFIG -= qt
SOURCES += \
main.cpp
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您的问题并不愚蠢,我认为每个在不遵循任何教程的情况下使用QT的人都可能遇到了这个问题,包括我。
我使用QT 6.6 QT创建的所有项目都有一个名为cmakelists.txt的文件。只需要打开该文件,它包含了其余代码文件等的路径。
Your question is not stupid, I think everyone who used Qt without following any tutorials may have had this problem, including me.
All my projects created with Qt 6.6 Qt Creator had a file named CMakeLists.txt. Just had to open that file and it contained the paths for the rest of the code files and etc.