You're running into this because szCopyright
, while declared const
, isn't a constant expression from the compiler's point of view during the compilation of other modules. In C, only literal constants can be used to initialize variables with static storage duration, like your myReference
. The workaround is to take the address of szCopyright
instead, which is a constant expression, like this: static const void *myReference = &szCopyright;
. This ensures the symbol gets pulled into the final link without violating compiler rules. Just make sure szCopyright
is defined in only one .c
file and declared extern
in the header.