I'm playing around with an ESP32 and C++
#include "OnBoardLED.cpp"
#include "esp_log.h"
#include <chrono>
#include <thread>
class Main {
const char *TAG = "Main";
public:
Main() { ESP_LOGI(TAG, "Constructor"); }
~Main() { ESP_LOGI(TAG, "Destructor"); }
void run() {
OnBoardLED led;
while (true) {
led.on();
std::this_thread::sleep_for(std::chrono::seconds(1));
led.off();
std::this_thread::sleep_for(std::chrono::seconds(1));
}
}
};
extern "C" {
void app_main(void) {
Main main;
main.run();
}
}
I don't fully understand why I get a compile error: undefined reference to OnBoardLED::OnBoardLED()collect2: error: ld returned 1 exit status.