Arduino IDE 在 const Struct 中使用 flash helper

Arduino IDE Using flash helper in const Struct

我上周使用 linux 笔记本电脑编写了一个 Arduino 代码。那里一切正常。现在我正在尝试使用 Windows 上的 IDE 获得相同的代码 运行。在那里,编译器抱怨 const 结构的初始化包含指向闪存中字符串的 const 指针。在初始化中使用 wString 之外的 F() 宏在 Windows 上不起作用。有什么解决方法吗?

typedef struct
{
    const __FlashStringHelper* desc;
    int a;    
} SensorStringInformation;

void setup()
{
       const SensorStringInformation res
       {
          F("Depth: "),
          2
       };
}

void loop()
{

}

非常感谢

找到了我的问题的答案。如果我像这样修改我的代码,它在两种情况下都能正常工作:

typedef struct
{
    const __FlashStringHelper* desc;
    int a;    
} SensorStringInformation;

void setup()
{
       const SensorStringInformation res = 
       {
          F("Depth: "),
          2
       };
}

void loop()
{

}