问题
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