I have a class that reads a bunch of strings into memory and then provides functions that allow applying operations on those strings and their relationships. As part of this I'd like to have a shared memory between the main.cpp where some of the operations are initiated and the class where the operations are completed. For this, in a previous post, it was suggested to use an extern type. But, now there is an error. How do I resolve this error and have a memory space shared by several classes?

The rules of an extern memory is explained here in this daniweb thread; the comment there is that yes, this should be simple but it is somehow not intuitive. The gist is that the memory is globally declared with the extern prefix in .cpp file A and then to reuse the memory in cpp B, globally declare it again in .cpp file B.

I think Luchian_Grigore and @jahhaj were getting there but we had either just not found the words for me to understand or they were still finding the words to explain.

You got it wrong. "The gist is that the memory is globally declared with the extern prefix in a .cpp file and then to reuse the memory, globally declare it again in that .cpp file." - you can declare it anywhere with extern. It's usually in a header because you can include that header in multiple places, but it can be anywhere. The second encounter in the cpp file is a definition. Totally different. This can be in only one place.
–
Luchian GrigoreJul 25 '12 at 22:52

there was a typo, I edited the answer - I could not get the extern memory to work from the header, though this seems like the logical approach. It works how I answered.
–
forest.petersonAug 2 '12 at 23:24