Pages: [1]   Go Down
Author Topic: static String  (Read 1306 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Newbie
*
Karma: 0
Posts: 2
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

hello,
i get some errors if i put
Code:
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?
thanks
stesmo
Logged

Global Moderator
Offline Offline
Brattain Member
*****
Karma: 452
Posts: 18694
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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:
// 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"
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 2
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

hello,
thank you for the answer! i did simply move the string outside, easiest way to solve it.  smiley-lol
Logged

Pages: [1]   Go Up
Jump to: