Hello, I’am having trouble with const data.
It should be easy, but…
(working with ESP32 on PlatformIO of course)
This is OK:
*main.cpp*
const char test[] = { 1,2,3 };
main() {
char buff[10];
strcpy(buff, (char *) test);
}
…but if the const data are on another file, linker returns Undefined Reference to test:
*main.cpp*
extern const char test[];
main() {
char buff[10];
strcpy(buff, (char *) test);
}
--------------------------
*file.cpp*
const char test[] = { 1,2,3 };
Thanks for help!