添加 TEMPLATE=subdirs 时 QT Creator 无法构建

发布于 2024-11-16 04:41:05 字数 194 浏览 4 评论 0原文

我是 QT Creator 的新手。我想创建一个带有 exe 和静态库的 QT 项目。

如果我首先创建 exe 项目,它对于每个构建配置都可以正常构建/重建。

但是,当我将 TEMPLATE = subdirs 添加到 .pro 文件末尾时,它会停止正确构建。但看来有必要将静态库添加到项目中。知道我可能做错了什么吗?

谢谢。

I'm new to QT Creator. I want to create a QT project with an exe and a static lib.

If I create the exe project first, it builds/rebuilds fine for every build configuration.

However, when i add TEMPLATE = subdirs to the end of the .pro file it stops building correctly. But it appears that is necessary to add static libs to the project. Any idea what I may be doing wrong?

Thanks.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

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

发布评论

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

评论(2

如果没结果 2024-11-23 04:41:05

这个想法是在顶层创建一个 TEMPLATE = subdirs 的 .pro 文件,然后将可执行文件放在一个子目录中,将库放在另一个子目录中。将两个目录添加到 SUBDIRS。

据我所知,使用 qmake 来构建某些东西并在一个 .pro 文件中递归是不可能的。

我不确定 Qt Creator 支持,但手动创建 TEMPLATE = subdirs .pro 文件很容易。

The idea is to have a .pro file with TEMPLATE = subdirs on the toplevel and then the executable in one subdirectory and the library in another. Add both directories to SUBDIRS.

AFAIK it is not (easily) possible with qmake to build something and also recurse in one .pro file.

I am not sure about Qt Creator support, but it is easy to create the TEMPLATE = subdirs .pro file by hand.

幼儿园老大 2024-11-23 04:41:05

编辑:

抱歉,我不明白你要做什么,你能解释得更好吗?

这有帮助吗:

可以通过使用 -t 命令行选项指定新的模板类型来覆盖该模板。这会在处理 .pro 文件后覆盖模板类型。对于使用模板类型来确定项目构建方式的 .pro 文件,有必要在命令行上声明 TEMPLATE,而不是使用 -t 选项。

来自此处

edit:

I'm sorry, I did not understand what you are trying to do, can you explain better?

Does this help:

The template can be overridden by specifying a new template type with the -t command line option. This overrides the template type after the .pro file has been processed. With .pro files that use the template type to determine how the project is built, it is necessary to declare TEMPLATE on the command line rather than use the -t option.

from here

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