C 在PlatformIO中使用ESP32时出现奇怪警告
当我尝试编译下面的代码时,我收到一个奇怪的警告。我认为这个警告是针对PlatformIO的,因为它没有显示在ArduinoIDE中。警告出现在该行之后 编译.pio\build\esp32dev\frameworkardino\Esp.cpp.o 这个警告有多严重 ESP32代码:C 在PlatformIO中使用ESP32时出现奇怪警告,c,arduino,esp32,platformio,C,Arduino,Esp32,Platformio,当我尝试编译下面的代码时,我收到一个奇怪的警告。我认为这个警告是针对PlatformIO的,因为它没有显示在ArduinoIDE中。警告出现在该行之后 编译.pio\build\esp32dev\frameworkardino\Esp.cpp.o 这个警告有多严重 ESP32代码: #include <Arduino.h> #include "BluetoothSerial.h" #include <WiFi.h> #include <EEPROM.h> B
#include <Arduino.h>
#include "BluetoothSerial.h"
#include <WiFi.h>
#include <EEPROM.h>
BluetoothSerial SerialBT;
//const char* ssid = "INOMETRICS";
const char *passd = "Innnnnnnnnnnnnometrics#";
void WiFiConfig() {
char buffer[60];
//strcpy_P(buffer, SSID_MEM);
Serial.println(buffer);
while (!SerialBT.available()); //Wait for config
String ssid = SerialBT.readString();
Serial.println(ssid); //Debugging
Serial.println("SSID Received!");
while (!SerialBT.available()); //Wait for config
String pass = SerialBT.readString();
Serial.println(pass); //Debugging
Serial.println("Password Received!");
WiFi.begin((const char*)ssid.c_str(), (const char*)pass.c_str()); //Connect to Router
while (WiFi.status() != WL_CONNECTED) {
delay(1000);
Serial.println("Establishing connection to WiFi..");
}
int len = strlen(passd);
Serial.println(len);
}
void setup() {
EEPROM.begin(512);
Serial.begin(115200);
SerialBT.begin("ESP32_INO");
Serial.println("The device started, now you can pair it with bluetooth!");
WiFiConfig();
Serial.println("Connected to network");
Serial.println(WiFi.macAddress());
Serial.println(WiFi.localIP());
}
void loop() {
}
C:\.platformio\packages\framework-arduinoespressif32\libraries\BluetoothSerial\src\BluetoothSerial.cpp: In function 'void esp_bt_gap_cb(esp_bt_gap_cb_event_t, esp_bt_gap_cb_param_t*)':
C:\.platformio\packages\framework-arduinoespressif32\libraries\BluetoothSerial\src\BluetoothSerial.cpp:328:18: warning: unused variable
'bda_str' [-Wunused-variable]
char bda_str[18];
^
C:\.platformio\packages\framework-arduinoespressif32\libraries\BluetoothSerial\src\BluetoothSerial.cpp: At global scope:
C:\.platformio\packages\framework-arduinoespressif32\libraries\BluetoothSerial\src\BluetoothSerial.cpp:79:14: warning: 'char* bda2str(uint8_t*, char*, size_t)' defined but not used [-Wunused-function]
static char *bda2str(esp_bd_addr_t bda, char *str, size_t size)
没有什么奇怪的。@kiranBiradar,我没听懂你的话。你的意思是这些警告并不严重,我可以忽略它。这不是你的问题,这是你正在使用的库的问题,很可能不是关键问题。如果要删除该消息,请在BluetoothSerial.o目标上使用
-Wno unused variable
。