First let me apologize for the title; I've looked up my problem and I think the reason I couldn't find an answer is my not knowing what the correct terms are.
This problem is best described by code:
1 2 3 4 5 6 7 8 9 10 11
|
// in code.cpp file
static const char LongArray0[1024] = { 'A' };
namespace a_name_space {
static const char LongArray1[1024] = { 'B' };
void a_class::a_method() {
static const char LongArray2[1024] = { 'C' };
char a = LongArray0[0];
char b = LongArray1[0];
char c = LongArray2[0];
}
}
|
My idea is that I have a very long array (preferably const) that is used only by a_class::a_method. I'd like that array to be private to only that file - I don't think I will need to make use of the array outside of this method, but this may change; I think it should be static because it is a very long array and needn't be initialized every time it is needed.
I have tried placing the LongArray in three places to different effects on compilation (using VS 2010 C++), most of them ending in:
LINK : fatal error LNK1104: cannot open file 'some_exeutable.exe' |
I have also tried using the scope resolution operator on LongArray0 because it is out of the namespace; it didn't work.
Funny enough, though, if I leave all the char a, char b, and char c lines on, it will compile without complaint. I have tried all combinations with each line commented out; they all end in the same error.