April 9, 2017 at 19:16 #10948
This may be more of a RTOS / programming question… but after scouring for a solution, I’ll start by asking here as almost all of the code is from the ESP8266 GDB Wizard when creating a sample project.
I am following the ESP8266 GDB tutorial here:
and I have it working properly.
The curious thing happens when I tried to add a new C++ class, and declare a global variable instantiating that class in the main application. As a global variable, compile fails with:
Severity Code Description Project File Line Suppression State
Error undefined reference to
__dso_handle'</strong> temp_ESP8266GDB C:\workspace\temp_ESP8266GDB\temp_ESP8266GDB\HTTPDemo.cpp 115__cxa_atexit‘ temp_ESP8266GDB C:\workspace\temp_ESP8266GDB\temp_ESP8266GDB\VisualGDB\Debug\HTTPDemo.o 1
<strong>Error undefined reference to
Error undefined reference to `__cxa_atexit’ temp_ESP8266GDB C:\workspace\temp_ESP8266GDB\temp_ESP8266GDB\HTTPDemo.cpp 34
Error ld returned 1 exit status temp_ESP8266GDB C:\workspace\temp_ESP8266GDB\temp_ESP8266GDB\collect2.exe 1
Even more interesting: the problem only occurs when there’s a destructor implemented.
If there’s no destructor, or the instance declaration is not global, there’s no error. As a local variable, there’s no complaint. The compile error only occurs for global declarations where the class includes a destructor.
The HX711.h header file:
and the HX711.cpp source file:
Surely I am missing something obvious. I am fairly new to RTOS, but as far as I can tell, there are no issues with global variables (other than of course, to be aware of the multi-treaded dangers). Are there indeed “issues” with destructors in RTOS global class instances?
I am running VisualGDB 5.2R9 (build 1452) in Visual Studio Enterprise 2017 Version 15.1 (26403.0) Release on Windows 10
Thanks in advanceApril 10, 2017 at 17:39 #10953
Thanks, looks like a toolchain bug. Can you reproduce this with the command-line ESP-IDF environment as well?April 18, 2017 at 00:36 #11009
I’ve not used the ESP-IDF command-line, nor have I been able to find it for the ESP8266. Is it the same as this one for the ESP32? This one:
The GitHub repository also only mentions the ESP32:April 19, 2017 at 06:25 #11023
ESP-IDF is for ESP32; if you are using ESP8266, it’s either RTOS SDK, or non-OS SDK. Both can be downloaded from here: https://espressif.com/en/support/download/sdks-demos
You can also simply post your test program here and we could quickly check if the problem is reproduced with the original command-line build tools.
You must be logged in to reply to this topic.