Chat here about code rewrites, mods, etc... with respect to the github project https://github.com/esp8266/Arduino

Moderator: igrr

User avatar
By OldBikerPete
#42090 I have been writing a watering system control sketch on the WeMos D1 mini and Arduino IDE.
I started by using the WebServer example and incrementally extending it to serve Web forms and to handle the returned codes using C/C++ functions. I thought that I had got the web server side of things all working as I was able to view all the forms and handle all the responses and everything compiled without errors.
Now I have written about 50 lines of code in loop() which use the data which the forms return. But the linking process has begun to object to a couple (the third and fourth in a group of nine) of server.on() statements in setup() which steer the responses from web POST forms to the functions which handle them. I was running 1.6.5 and I installed the latest 1.6.7 but no change.

The error messages are attached below: help?
C:\Users\Peter\AppData\Local\Temp\builda8baab0d0ff6eaffac5a8c45ff0ec3a7.tmp\sketch\Watering.ino.cpp.o: In function `setup':

Y:\Profile\My Documents\Arduino\Watering/Watering.ino:979: undefined reference to `__cxa_guard_acquire'

C:\Users\Peter\AppData\Local\Temp\builda8baab0d0ff6eaffac5a8c45ff0ec3a7.tmp\sketch\Watering.ino.cpp.o: In function `function<setup()::__lambda2, void>':

c:\users\peter\appdata\local\arduino15\packages\esp8266\tools\xtensa-lx106-elf-gcc\1.20.0-26-gb404fb9-2\xtensa-lx106-elf\include\c++\4.8.2/functional:2453: undefined reference to `__cxa_guard_release'

C:\Users\Peter\AppData\Local\Temp\builda8baab0d0ff6eaffac5a8c45ff0ec3a7.tmp\sketch\Watering.ino.cpp.o: In function `setup':

Y:\Profile\My Documents\Arduino\Watering/Watering.ino:980: undefined reference to `__cxa_guard_acquire'

C:\Users\Peter\AppData\Local\Temp\builda8baab0d0ff6eaffac5a8c45ff0ec3a7.tmp\sketch\Watering.ino.cpp.o: In function `~function':

c:\users\peter\appdata\local\arduino15\packages\esp8266\tools\xtensa-lx106-elf-gcc\1.20.0-26-gb404fb9-2\xtensa-lx106-elf\include\c++\4.8.2/functional:2174: undefined reference to `__cxa_guard_release'

collect2.exe: error: ld returned 1 exit status

Using library ESP8266WiFi at version 1.0 in folder: C:\Program Files (x86)\arduino-1.6.7\hardware\esp8266com\esp8266\libraries\ESP8266WiFi
Using library ESP8266WebServer at version 1.0 in folder: C:\Program Files (x86)\arduino-1.6.7\hardware\esp8266com\esp8266\libraries\ESP8266WebServer
Using library ESP8266mDNS in folder: C:\Program Files (x86)\arduino-1.6.7\hardware\esp8266com\esp8266\libraries\ESP8266mDNS (legacy)
exit status 1
Error compiling.
User avatar
By OldBikerPete
#42132
martinayotte wrote:I think such error were there before this commit :
https://github.com/esp8266/Arduino/comm ... a0a21eff90
Simply update to the newest 2.1.0 ...


1> As the heading says, I am running the lastest, most recently compiled versions of Arduino (1.6.7) and of the boards download (2.1.0-rc2).
2> I was able to make the changes to the umm_malloc.h file but the umm_malloc_cfg.h file has no part of it that looks like the edit displayed and it has no extern "C" statements in it at all.
3> After making the changes to the umm_malloc.h file, the linker errors are unchanged.

EDIT: After searching through the Arduino install folder, I've found that the "__cxa_guard_acquire" and "__cxa_guard_release" strings only occur within the cc1plus.exe file. ie within the compiler executable, so why is the linker trying to link to two instances of each within my sketch?

2nd EDIT: I have been selectively commenting out portions of my code in the loop() function and have found a line which was causing the conniptions. Here are my variable declarations at the start of loop():
void loop(void) {
static CHRONTAB_STATE chronState = TESTING;
static PROGRAM_STATE progState = PROG_IDLE;
static uint16_t wateringIsOn;
// static File file;
String line;
uint16_t i, seconds, circuit;
char *cp, c;

The problem was triggered by declaring a variable of type 'File' to be static. Declare it as a global and the problem goes away to lurk, waiting.