Open Pyro-E opened 2 days ago
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
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.
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 tovtable 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 tovtable 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