gpt4 book ai didi

c - ArduinoJSON 未定义对 `__cxa_guard_acquire' 的引用

转载 作者:行者123 更新时间:2023-12-05 09:20:10 24 4
gpt4 key购买 nike

我正在绘制草图,我正在使用 ArduinoJSON。我想我可能会解决这个问题,看看人们是否看到了这个错误。

WifiNest.cpp.o:(.text._ZN11ArduinoJson9JsonArray7invalidEv[_ZN11ArduinoJson9JsonArray7invalidEv]+0x8): undefined reference to `__cxa_guard_acquire'
WifiNest.cpp.o:(.text._ZN11ArduinoJson9JsonArray7invalidEv[_ZN11ArduinoJson9JsonArray7invalidEv]+0xc): undefined reference to `__cxa_guard_release'
WifiNest.cpp.o: In function `ArduinoJson::JsonArray::invalid()':
C:\Program Files (x86)\Arduino/WifiNest.ino:156: undefined reference to `__cxa_guard_acquire'
C:\Program Files (x86)\Arduino/WifiNest.ino:156: undefined reference to `__cxa_guard_release'
WifiNest.cpp.o: In function `ArduinoJson::JsonObject::invalid()':
C:\Program Files (x86)\Arduino/WifiNest.ino:156: undefined reference to `__cxa_guard_acquire'
C:\Program Files (x86)\Arduino/WifiNest.ino:156: undefined reference to `__cxa_guard_release'
collect2.exe: error: ld returned 1 exit status
Error compiling.

这是我创建 jsonArray 对象的 Arduino 代码的一部分:

char jsonArray [result.length()+1];
result.toCharArray(jsonArray,sizeof(jsonArray));
jsonArray[result.length() + 1] = '\0';

DynamicJsonBuffer json_buf;
JsonObject &root = json_buf.parseObject(jsonArray);
if (!root.success())
{
Serial.println("parseObject() failed");
}

这里是 JSONArray 无效函数:

static JsonArray &invalid() {
static JsonArray instance(NULL);
return instance;
}

这里是 JSONObject 无效函数:

// Returns a reference an invalid JsonObject.
// This object is meant to replace a NULL pointer.
// This is used when memory allocation or JSON parsing fail.
static JsonObject& invalid() {
static JsonObject instance(NULL);
return instance;
}

最佳答案

尝试使用以下编译标志:

-fno-threadsafe-statics

Do not emit the extra code to use the routines specified in the C++ ABI for thread-safe initialization of local statics. You can use this option to reduce code size slightly in code that doesn't need to be thread-safe.

查看问题 #356#361

关于c - ArduinoJSON 未定义对 `__cxa_guard_acquire' 的引用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38779413/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com