esp8266-esp32-sdk
esp8266-esp32-sdk copied to clipboard
Error compiling code - vtable undefined
Hi, getting error with "undefined reference to vtable" during compiling. Please help?
HW - esp32c6
Error:
/Users/IoT/Library/Arduino15/packages/esp32/tools/esp-rv32/2302/bin/../lib/gcc/riscv32-esp-elf/12.2.0/../../../../riscv32-esp-elf/bin/ld: /private/var/folders/5w/fptbs2sd1fs1wcpbs_78bfcr0000gp/T/arduino/sketches/32815A3D67364512A0EE046AE4D8E164/sketch/main.ino.cpp.o: in function SINRICPRO_3_0_1::SinricProDeviceInterface::SinricProDeviceInterface()': .../SinricPro/src/SinricProDeviceInterface.h:9: undefined reference to vtable for SINRICPRO_3_0_1::SinricProDeviceInterface'
/Users/IoT/Library/Arduino15/packages/esp32/tools/esp-rv32/2302/bin/../lib/gcc/riscv32-esp-elf/12.2.0/../../../../riscv32-esp-elf/bin/ld: /Users/IoT/Pyro-E Dropbox/Kevin Lu/Pyro-E/PyroE codes/Arduino/libraries/SinricPro/src/SinricProDeviceInterface.h:9: undefined reference to vtable for SINRICPRO_3_0_1::SinricProDeviceInterface' /Users/IoT/Library/Arduino15/packages/esp32/tools/esp-rv32/2302/bin/../lib/gcc/riscv32-esp-elf/12.2.0/../../../../riscv32-esp-elf/bin/ld: /private/var/folders/5w/fptbs2sd1fs1wcpbs_78bfcr0000gp/T/arduino/sketches/32815A3D67364512A0EE046AE4D8E164/sketch/main.ino.cpp.o: in function SINRICPRO_3_0_1::SinricProInterface::SinricProInterface()':
.../src/SinricProInterface.h:16: undefined reference to vtable for SINRICPRO_3_0_1::SinricProInterface' /Users/IoT/Library/Arduino15/packages/esp32/tools/esp-rv32/2302/bin/../lib/gcc/riscv32-esp-elf/12.2.0/../../../../riscv32-esp-elf/bin/ld: .../src/SinricProInterface.h:16: undefined reference to vtable for SINRICPRO_3_0_1::SinricProInterface'
collect2: error: ld returned 1 exit status
exit status 1
Compilation error: exit status 1
Please try with the latest version is 3.1.0
Please name the Espressif32 Arduino Core Version, the board and the sketch you're trying to compile.
I have no issues compiling the switch example for ESP32C6 Dev Module
- Espressif Arduino Core version 3.0.2
- ArduinoJson version 7.0.4
- WebSockets version 2.4.1
Still same error.
My code (power measure):
//board - https://wiki.seeedstudio.com/xiao_esp32c6_zigbee/
//Espressif Arduino Core version 3.0.2
//ArduinoJson version 7.1.0
//WebSockets version 2.4.1
bool powerState = false;
// struct to store measurement from powersensor
struct {
float voltage;
float current;
float power;
float apparentPower;
float reactivePower;
float factor;
} powerMeasure;
// this is where you read from power sensor
// in this example, random values are used
void doPowerMeasure() {
powerMeasure.voltage = random(2200,2300) / 10.0f;
powerMeasure.current = random(1,20) / 10.0f;
// powerMeasure.power = myIMU.readFloatAccelZ(); // powerMeasure.voltage * powerMeasure.current;
// powerMeasure.apparentPower = myIMU.readFloatGyroZ(); // powerMeasure.power + (random(10,20)/10.0f);
}
void sendPowerSensorData() {
// limit data rate to SAMPLE_EVERY_SEC
static unsigned long lastEvent = 0;
unsigned long actualMillis = millis();
if (actualMillis - lastEvent < (SAMPLE_EVERY_SEC * 1000)) return;
lastEvent = actualMillis;
doPowerMeasure();
// send measured data
SinricProPowerSensor &myPowerSensor = SinricPro[POWERSENSOR_ID];
bool success = myPowerSensor.sendPowerSensorEvent(powerMeasure.voltage, powerMeasure.current, powerMeasure.power, powerMeasure.apparentPower);
if(!success) {
Serial.printf("Something went wrong...could not send Event to server!\r\n");
}
}
void setupWiFi() {
Serial.printf("\r\n[Wifi]: Connecting");
#if defined(ESP8266)
WiFi.setSleepMode(WIFI_NONE_SLEEP);
WiFi.setAutoReconnect(true);
#elif defined(ESP32)
WiFi.setSleep(false);
WiFi.setAutoReconnect(true);
#endif
WiFi.begin(WIFI_SSID, WIFI_PASS);
while (WiFi.status() != WL_CONNECTED) {
Serial.printf(".");
delay(250);
}
IPAddress localIP = WiFi.localIP();
Serial.printf("connected!\r\n[WiFi]: IP-Address is %s\r\n", WiFi.localIP().toString().c_str());
}
void setupSinricPro() {
SinricProPowerSensor &myPowerSensor = SinricPro[POWERSENSOR_ID];
// setup SinricPro
//SinricPro.restoreDeviceStates(true); // Uncomment to restore the last known state from the server.
SinricPro.onConnected([](){ Serial.printf("Connected to SinricPro\r\n"); });
SinricPro.onDisconnected([](){ Serial.printf("Disconnected from SinricPro\r\n"); });
SinricPro.begin(APP_KEY, APP_SECRET);
}
// main setup function
void setup() {
Serial.begin(BAUD_RATE);
setupWiFi();
setupSinricPro();
}
void loop() {
SinricPro.handle();
sendPowerSensorData();
}
After adding a few missing lines to your sketch above
#include <WiFi.h>
#include <SinricPro.h>
#include <SinricProPowerSensor.h>
const char* WIFI_SSID = "";
const char* WIFI_PASS = "";
const char* APP_KEY = "";
const char* APP_SECRET = "";
const char* POWERSENSOR_ID = "";
const int BAUD_RATE = 115200;
const int SAMPLE_EVERY_SEC = 60;
The sketch compiles fine:
Sketch uses 1091744 bytes (83%) of program storage space. Maximum is 1310720 bytes.
Global variables use 41360 bytes (12%) of dynamic memory, leaving 286320 bytes for local variables. Maximum is 327680 bytes.
Yes, I have those header lines. I used a new computer, reinstalled board/library, still getting this:
/Users/IoT/Library/Arduino15/packages/esp32/tools/esp-rv32/2302/bin/../lib/gcc/riscv32-esp-elf/12.2.0/../../../../riscv32-esp-elf/bin/ld: /private/var/folders/5w/fptbs2sd1fs1wcpbs_78bfcr0000gp/T/arduino/sketches/1CA1E89C3A493BAF4696B37BD3D9326E/sketch/PowerSensor.ino.cpp.o: in function `SINRICPRO_3_1_0::SinricProDeviceInterface::SinricProDeviceInterface()':
SinricProDeviceInterface.h:9: undefined reference to `vtable for SINRICPRO_3_1_0::SinricProDeviceInterface'
SinricProDeviceInterface.h:9: undefined reference to `vtable for SINRICPRO_3_1_0::SinricProDeviceInterface'
/Users/IoT/Library/Arduino15/packages/esp32/tools/esp-rv32/2302/bin/../lib/gcc/riscv32-esp-elf/12.2.0/../../../../riscv32-esp-elf/bin/ld: /private/var/folders/5w/fptbs2sd1fs1wcpbs_78bfcr0000gp/T/arduino/sketches/1CA1E89C3A493BAF4696B37BD3D9326E/sketch/PowerSensor.ino.cpp.o: in function `SINRICPRO_3_1_0::SinricProInterface::SinricProInterface()':
SinricProInterface.h:16: undefined reference to vtable for SINRICPRO_3_1_0::SinricProInterface' SinricProInterface.h:16: undefined reference to vtable for SINRICPRO_3_1_0::SinricProInterface'
collect2: error: ld returned 1 exit status
exit status 1
Compilation error: exit status 1
Hi,
-
Are you using Ubuntu or Mac?
-
Arduino IDE version
I will try on my local setup and try to replicate
Hi,
Mac Arduino IDE 2.3.2
Tried 3 built-in examples with the same error.
Arduino IDE: 2.3.2 ESP32 Core: 3.0.2 MacMini: M1 - 13.6 SinricPro: 3.0.1
can compile the switch sketch with ESP32C6
Does a simple "Hello World" compile?
#include <Arduino.h>
void setup() {
Serial.begin(115200);
Serial.println("Hello World");
}
void loop{}
Come on, Sivar :)
Ok it's uploading on a different mac user... No idea why. I'm online :)
You never know ... ;)
What I wanted to say: Does this error also occur with other sketches?
But it is strange that it works with another user.
I also get this error if I add build_type = debug ti my platformio.ini file for using platformio inspect.
c:/users/user/.platformio/packages/toolchain-xtensa-esp32/bin/../lib/gcc/xtensa-esp32-elf/12.2.0/../../../../xtensa-esp32-elf/bin/ld.exe: .pio/build/esp32_v3/src/main.ino.cpp.o:(.literal._ZN15SINRICPRO_3_2_015SinricProDeviceC2ERK6StringS3_+0x0): undefined reference to vtable for SINRICPRO_3_2_0::SinricProDeviceInterface'
c:/users/user/.platformio/packages/toolchain-xtensa-esp32/bin/../lib/gcc/xtensa-esp32-elf/12.2.0/../../../../xtensa-esp32-elf/bin/ld.exe: .pio/build/esp32_v3/src/main.ino.cpp.o:(.literal._ZN15SINRICPRO_3_2_014SinricProClassC5Ev[_ZN15SINRICPRO_3_2_014SinricProClassC5Ev]+0x0): undefined reference to vtable for SINRICPRO_3_2_0::SinricProInterface
Im using the following in my playformio file
platform = [email protected]
platform_packages=
framework-arduinoespressif32 @ https://github.com/espressif/arduino-esp32.git#3.0.3
framework-arduinoespressif32-libs @ https://github.com/espressif/arduino-esp32/releases/download/3.0.3/esp32-arduino-libs-3.0.3.zip
Please try if this also happens without the Arduino 3.0.3 packages (espressif32 @ 6.8.1 is Arduino Core 2.0.17) Also please share the full platformio.ini and a minimal project to reproduce the error.
I fixed this by downgrading the ESP32 in boards manager down to 2.0.13
i also face same issue please help me
Some users suggest uninstalling everything and reinstalling worked for them
Can you share the following so we can reproduce.
Arduino IDE version Arduino-ESP core version for ESP32 / ESP8266 OS and Version
On Wed, 6 Nov 2024 at 5:55 PM Akashxohani @.***> wrote:
i also face same issue please help me
— Reply to this email directly, view it on GitHub https://github.com/sinricpro/esp8266-esp32-sdk/issues/388#issuecomment-2459432001, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABZAZZQAWMZQTWHHMX7J2NDZ7HYTHAVCNFSM6AAAAABKELT3DGVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDINJZGQZTEMBQGE . You are receiving this because you commented.Message ID: @.***>