title: Linker error with global variables in .h files
body: <p>I have the following .h file</p>
  
  <pre><code>#ifndef _EXCEPTION_H
  #define _EXCEPTION_H
  
  ...
  
  const char* _ErrorCode[] = {
      "%s",
      "Error: Index is out of range.",
      "Error: Stack is empty.",
      "Error: New matrix size is not greater than current one.",
      "Error: Index or size cannot be negative.",
      "Error: Method option is not within permissible options."
      "Error: File could not be found or created."
      "Error: There was not enough memory to allocate container."
                         }; // Error code list
  
  ...
  
  #endif
  </code></pre>
  
  <p>that is included by many files. But when i try to compile, i get the following linker error:</p>
  
  <pre><code>4 warnings generated.
  duplicate symbol __ErrorCode in:
      exception.o
      graph.o
  duplicate symbol __ErrorCode in:
      exception.o
      io.o
  duplicate symbol __ErrorCode in:
      exception.o
      list.o
  duplicate symbol __ErrorCode in:
      exception.o
      matrix.o
  duplicate symbol __ErrorCode in:
      exception.o
      stack.o
  </code></pre>
  
  <p>which means the compiler is redefining the _ErrorCode global variable in all the files in which exception.h is included even though there is an #ifndef at the beginning of the file. How do i stop this from happening? If i can't, how do i define a read-only array of strings that i can print in case of errors like this?</p>