QT创建者:如何打开现有项目?

发布于 2025-02-02 17:28:07 字数 978 浏览 2 评论 0原文

首先,如果我的问题很愚蠢,我深表歉意。尽管看起来很容易,但我找不到解决方案。

我是QT创作者的新手。我将其安装在Linux上。每当我想打开一个现有项目时,我都会很难。因此,当我从“欢迎”选项卡中选择一个现有项目时,显示了最近创建的项目的列表。从此列表中选择很简单。当我查看路径时,它像.../project_folder/file.pro时,选择后者时,在“编辑”选项卡中,我将拥有如图1所述的内容,我可以访问main.cpp文件。并编辑它: “图1”

但是,当未列出项目并且必须单击“打开project”并浏览project_folder中的pro.pro时,它要求我“配置项目”和“导入现有构建” 。我知道相对于Project_Folder的构建文件夹位于../build_folder中。我手动添加这条路。现在,在“编辑”选项卡中,我只有一个只有.pro文件的文件夹。因此,无法访问main.cpp。如图2所示,其中第二个项目是helloworld: ”图2“

现在,问题是如何以我可以编辑的方式打开现有项目。我知道这应该非常简单,但是我无法弄清楚。

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: Figure 1

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: Figure 2

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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

小…红帽 2025-02-09 17:28:07

您的问题并不愚蠢,我认为每个在不遵循任何教程的情况下使用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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文