字串化与USERNAME工作:密码,但不用于串行:TOKEN? [英] Stringification working with USERNAME:PASSWORD but not for SERIAL:TOKEN?
问题描述
我有以下的Makefile(如果你问我为什么有\\收录你可以参考我的 previous问题)
I have the following Makefile (If you are asking me why there's \" included you can refer to my previous question)
BOARD_TAG = mega2560
CPPFLAGS = -DUSERNAME=\"$(USERNAME)\" -DPASSWORD=\"$(PASSWORD)\"
include $(ARDMK_DIR)/Arduino.mk
和code:
void setup() {
Serial.begin(9600);
String auth_raw2(USERNAME ":" PASSWORD);
Serial.println(auth_raw2);
}
void loop() {}
当我编译这与让USERNAME =你好PASSWORD =世界
,一切正常,我看到'你好:世界上。被打印出来。
when I compile this with make USERNAME=hello PASSWORD=world
, everything works and I see 'hello:world' being printed out.
不过,如果我替换USERNAME串行和密码令牌:
However, if I substitute USERNAME to SERIAL and PASSWORD to TOKEN:
BOARD_TAG = mega2560
CPPFLAGS = -DSERIAL=\"$(SERIAL)\" -DTOKEN=\"$(TOKEN)\"
include $(ARDMK_DIR)/Arduino.mk
和
void setup() {
Serial.begin(9600);
String auth_raw2(SERIAL ":" TOKEN);
Serial.println(auth_raw2);
}
void loop() {}
我收到错误, macro.ino:5:27:错误:预期')'字符串常量前
注意$ USERNAME是在我的Linux机器定义为 disappearedng
而$的密码,$串行和$令牌是不确定的。
Note that $USERNAME is defined on my linux box as disappearedng
while $PASSWORD, $SERIAL, and $TOKEN are undefined.
为什么用于USERNAME这项工作:密码,但不用于串行:TOKEN
推荐答案
所以它看起来像Arduino的覆盖$ SERIAL参数。
So it seems like Arduino overrides the $SERIAL parameter.
切换串行DSERIAL使得编译确定
Switching SERIAL to DSERIAL makes compiling ok
这篇关于字串化与USERNAME工作:密码,但不用于串行:TOKEN?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!