如何在.pro文件中为TARGET使用空格和尖括号
How to use spaces and angle brackets for TARGET in .pro file
我想将我的Qt应用程序命名为
测试<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将不可用。大多数操作系统都保留了这些字符,尽管具有这样名称的文件在文件系统中可能是可表示的,但它不能以典型的方式使用。有关概述,请参见例如文件名:保留字符和单词。
应用程序窗口的标题(例如,如图所示(与文件名无关。您可以使用QWidget
的windowTitle
属性将它们设置为您想要的任何值。
相关文章:
- 2D数组来自文本输入,中间有空格
- 为字符串中每 N 个字符插入空格的函数没有按照我认为的方式工作?
- 如何在C++中读取空格分隔的输入 当我们不知道输入的数量时
- 如何在c++中使用system()来运行包含空格的python脚本
- basic_string的前导/尾部不区分空格的特征
- 移除前面有空格的前2个字符串
- 如何将以逗号和空格分隔的整数读取到 2D 数组中?
- 如何在 C++ 中从文件中读取字符数组(带有一些空格)
- CMake "--target install"无需"--build"命令行
- 如何逐行读取文件,每行中的内容都用空格分隔并将其写入新文件中
- 为什么 c++(g++) 不允许模板返回类型和函数名称之间有空格?
- 用于存储由空格分隔的字符串的 C++/C 数据结构
- 在字符串中插入空格
- C ++中的StringStream有助于使用向量从字符串中提取逗号分隔的整数,而不是空格分隔的整数,为什么?
- C++为一串单词添加空格
- 使用另一个字符串从字符串中删除空格
- 我还可以添加什么来按空格或空格正确拆分C++字符串?
- 如何打印不带空格的输入整数?
- 野牛/yacc 解析器在不被空格分隔时跳过 grammer - "unexpected $end"
- 如何在.pro文件中为TARGET使用空格和尖括号