【问题描述】
在Arduino esp8266 IDE 下,调用微信airkiss 接口,编译成功,但是链接失败。
例如,我调用airkiss_version()接口,提示"undefined reference to `airkiss_version'.
在esp8266 扩展板描述文件中,有airkiss.h以及libairkiss.a
airkiss.h:Arduino\hardware\espressif\esp8266\tools\sdk\include"
ibairkiss.a :"Arduino\hardware\espressif\esp8266\tools\sdk\lib" 我是在官方样例上修改的,官方样例调用esp8266 原生接口“wifi_station_get_hostname()”是OK的。 但增加airkiss_version()接口调用就是不行,一直提示:undefined reference to `airkiss_version'. 【求助】 从提示来看,应该就是链接失败。我已经按照C++调用C的方式进行声明,但是一直提示有问题。 【源代码 】 // Expose Espressif SDK functionality - wrapped in ifdef so that it still
// compiles on other platforms
#ifdef ESP8266
extern "C" {
#include "user_interface.h"
#include "airkiss.h"
} #endif void setup() {
Serial.begin(115200);
} void loop() {
// Call Espressif SDK functionality - wrapped in ifdef so that it still
// compiles on other platforms
#ifdef ESP8266
Serial.print("wifi_station_get_hostname: ");
Serial.println(wifi_station_get_hostname());
Serial.println(airkiss_version());
#endif
delay(1000);
}
【Debug信息】 Archiving built core (caching) in: \AppData\Local\Temp\arduino_cache_581525\core\core_espressif_esp8266_nodemcuv2_CpuFrequency_160,UploadSpeed_115200,FlashSize_4M1M_9e863c8058aaa52e06769f0454a69ae4.a
sketch\CallSDKFunctions.ino.cpp.o: In function `setup': \Documents\Arduino\CallSDKFunctions/CallSDKFunctions.ino:25: undefined reference to `airkiss_version' sketch\CallSDKFunctions.ino.cpp.o: In function `loop': \Documents\Arduino\CallSDKFunctions/CallSDKFunctions.ino:31: undefined reference to `airkiss_version' collect2.exe: error: ld returned 1 exit status exit status 1
|