在qmake命令行中定义一个字符串 [英] Define a string in qmake command line
本文介绍了在qmake命令行中定义一个字符串的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我需要将一个字符串作为定义传递给我的源代码,这是一个base64编码的字符串(可能包含 /
和>
$ b
qmake DEFINES + = SERIAL = \\\\f9a / z\\\\
qmake DEFINES + = SERIAL = \f9a / z\
qmake DEFINES + =SERIAL = \\f9a / z\\\\
G ++应该得到像这样的序列:
g ++ -DSERIAL = \f9a / z\
$ c $在bash中:
> qmake DEFINES + = SERIAL = \\\\\\\\f9a / z\\\\\\\\
在脚本语言中:
DEFINES + = SERIAL = \\\\\\+ str +\\\\\\\
I need to pass a string as a definition to my source code which is a base64 encoded string (so may contain /
and "
). I'm using qmake and g++. I've tried so many combinations, but neither works:
qmake DEFINES+=SERIAL=\\\"f9a/z\\\"
qmake DEFINES+=SERIAL=\"f9a/z\"
qmake DEFINES+="SERIAL=\\"f9a/z\\\""
G++ should get the serial like this:
g++ -DSERIAL=\"f9a/z\"
解决方案 In bash:
qmake DEFINES+=SERIAL=\\\\\\\"\"f9a/z\\\\\\\"\"
In a scripting language:
"DEFINES+=SERIAL=\\\\\\\"" + str + "\\\\\\\""
这篇关于在qmake命令行中定义一个字符串的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文