Go Down

Topic: static String (Read 2145 times) previous topic - next topic


i get some errors if i put
Code: [Select]
static String test = "test";
into a basic arduino program:
undefined reference to `__cxa_guard_acquire'
undefined reference to `__cxa_guard_release'
undefined reference to `atexit'
without the static keyword everything is okay. is this behavior normal?

Nick Gammon

Yeah, that obscure message is normal. You could move the string outside a function, then you won't get it. Or you can add this to near the top of your code:

Code: [Select]
// this blathering on is in case you want to make the class a static variable in a function
extern "C" {
  __extension__ typedef int __guard __attribute__((mode (__DI__)));
  int __cxa_guard_acquire(__guard *g) { return !*(char *)(g); };
  void __cxa_guard_release (__guard *g) { *(char *)g = 1; };
  void __cxa_guard_abort (__guard *) { };
} // end extern "C"
Please post technical questions on the forum, not by personal message. Thanks!

More info:


thank you for the answer! i did simply move the string outside, easiest way to solve it.  XD

Go Up

Please enter a valid email to subscribe

Confirm your email address

We need to confirm your email address.
To complete the subscription, please click the link in the email we just sent you.

Thank you for subscribing!

via Egeo 16
Torino, 10131