Possible Duplicate:
Why does const imply internal linkage in C++, when it doesn’t in C?
What is external linkage and internal linkage in C++
I have a two C files that I'm trying to compile to an executable. One file contains only a single declaration as follows (simplifed).
const char *foo[2] = {"thing1", "thing2"};
The second c file does this
extern const char *foo[2];
main()
{
//Code that does stuff with foo
}
When compiling I get a linker error that foo is an unresolved external symbol. I'm assuming the compiler is optimizing out foo. Any ideas here?