Q:

mysterious linker warning: public symbol defined in both modules

I have 2 arrays of string that are defined in a header file like this:
#ifndef DRC_DefinesH
#define DRC_DefinesH
#include <string>
#include <System.hpp>
//---------------------------------------------------------------------------

std::string MagFields[] = {
   "SCAN", "EVENT", "EVENT2", "EVENT1", "EVENT3", "VECTORX", "VECTORY", "VECTORZ", "MAG1RAW", "MAG2RAW", "MAG3RAW",
   "MAG4RAW", "MAG1UNCOMP", "MAG2UNCOMP", "MAG3UNCOMP", "MAG4UNCOMP", "MAG1COMP", "MAG2COMP", "MAG3COMP", "MAG4COMP",
   "GRAD1", "GRAD2", "GRAD3", "UTC", "LAT", "LON", "ALT", "ANALOG1", "ANALOG2", "ANALOG3", "ANALOG4", "SYSTIME"};

std::string AnalogFields[] = {
   "SCAN", "EVENT0", "EVENT1", "EVENT2", "EVENT3", "ANALOG1", "ANALOG2", "ANALOG3", "ANALOG4", "ANALOG5", "ANALOG6",
   "ANALOG7", "ANALOG8", "ANALOG9", "ANALOG10", "ANALOG11", "ANALOG12", "ANALOG13", "ANALOG14", "ANALOG15", "ANALOG16",
   "ANALOG17", "ANALOG18", "ANALOG19", "ANALOG20", "ANALOG21", "ANALOG22", "ANALOG23", "ANALOG24", "ANALOG25",
   "ANALOG26", "ANALOG27", "ANALOG28", "ANALOG29", "ANALOG30", "ANALOG31", "ANALOG32"};

... other stuff

    #endif

This header contains lots of other stuff and is included indirectly in every unit in a C++ Builder XE2 project. When I build the project I get LOTS of linker warnings stating that 
"public symbol _MagFields and _AnalogFields are defined in both modules AAA and BBB" 
where AAA and BBB are, successively, every combination of units in the project.
These particular declarations can be moved into the implementation side of a unit and the warnings go away, but I'd like to understand why it is necessary. The Embarcadero documentation just tells me how to get rid of the warning, not what it means.

A:

You're defining the arrays in a header, giving a definition in every translation unit that includes the header. But you're only allowed a single definition, since the definition is what causes memory to be allocated for the array, and it can only exist in one place. That's known as the One Definition Rule.
Move the definitions into a source file, so they're not duplicated. Then just declare the arrays in the header:
extern std::string MagFields[];
extern std::string AnalogFields[];

Another option, if you don't need to modify them, is to declare them const to give them internal linkage, so that each translation unit that includes the definition gets its own copy of the array. That has the downside that you'll end up with multiple copies of the arrays in your program, wasting memory.

