Sysprogs forums › Forums › VisualGDB › ESP8266 GDB RTOS Global Class – Error undefined reference to __dso_handle'
- This topic has 3 replies, 2 voices, and was last updated 7 years, 6 months ago by support.
-
AuthorPosts
-
April 9, 2017 at 19:16 #10948gojimmypiParticipant
Greetings.
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:
https://visualgdb.com/tutorials/esp8266/gdbstub/
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
<strong>Error undefined reference to `__cxa_atexit‘ temp_ESP8266GDB C:\workspace\temp_ESP8266GDB\temp_ESP8266GDB\VisualGDB\Debug\HTTPDemo.o 1
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 1Even 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:
#ifndef HX711_h
#define HX711_hclass HX711
{public:
HX711();
~HX711();
};and the HX711.cpp source file:
#include “HX711.h”
HX711::HX711()
{
}HX711::~HX711()
{
}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 advance
April 10, 2017 at 17:39 #10953supportKeymasterHi,
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 #11009gojimmypiParticipantI’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:
http://esp-idf.readthedocs.io/en/latest/windows-setup.html
The GitHub repository also only mentions the ESP32:
April 19, 2017 at 06:25 #11023supportKeymasterESP-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.
-
AuthorPosts
- You must be logged in to reply to this topic.