Define a string in qmake command line

吃可爱长大的小学妹 提交于 2019-12-10 14:07:24

问题


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\"

回答1:


In bash:

qmake DEFINES+=SERIAL=\\\\\\\"\"f9a/z\\\\\\\"\"

In a scripting language:

"DEFINES+=SERIAL=\\\\\\\"" + str + "\\\\\\\""


来源:https://stackoverflow.com/questions/21308363/define-a-string-in-qmake-command-line

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!