gpt4 book ai didi

c++ - 如何在 .pro 文件中为 TARGET 使用空格和尖括号

转载 作者:行者123 更新时间:2023-11-28 04:35:51 25 4
gpt4 key购买 nike

我想将我的 Qt 应用程序命名为

test <2>

所以我把我的 .pro 文件写成

TEMPLATE = app
TARGET = test\\\ \\\<2\\\>

QT = core gui

greaterThan(QT_MAJOR_VERSION, 4): QT += widgets

SOURCES += main.cpp

但是构建的时候失败了:

11:14:31: Running steps for project asdf...
11:14:31: Configuration unchanged, skipping qmake step.
11:14:31: Starting: "/usr/bin/make"
/home/erik/Qt/5.11.1/gcc_64/bin/qmake -o Makefile ../asdf/asdf.pro -spec linux-g++ CONFIG+=debug CONFIG+=qml_debug
WARNING: DESTDIR: Cannot access directory '../build-asdf-Desktop_Qt_5_11_1_GCC_64bit-Debug/test/ /<2'
/bin/sh: 1: cannot open 2/: No such file
/bin/sh: 1: cannot open 2/: No such file
Makefile:254: recipe for target 'test/ //<2/>' failed
make: *** [test/ //<2/>] Error 2
11:14:31: The process "/usr/bin/make" exited with code 2.
Error while building/deploying project asdf (kit: Desktop Qt 5.11.1 GCC 64bit)
When executing step "Make"
11:14:31: Elapsed time: 00:00.

TARGET中的字符应该如何转义?

最佳答案

你不应该,在 qmake 的情况下:你不能,因为生成的 makefile 将无法使用。大多数操作系统保留这些字符,虽然具有这样名称的文件可以在文件系统中表示 - 它不能以典型方式使用。参见例如Filename:Reserved characters and words概览。

应用程序窗口的标题(例如 here )与文件名无关。您可以使用 QWidgetwindowTitle 属性将它们设置为您想要的任何值。

关于c++ - 如何在 .pro 文件中为 TARGET 使用空格和尖括号,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51461739/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com