title: Link error when declaring public static variables in C++
body: <p>I have this class with variable configuration parameters. I want to include it in other classes: <code>JugadorHumano</code>, <code>JugadorIA</code>, <code>Main</code>, <code>PartidaClasica</code>, <code>PartidaMision</code>.</p>
  
  <pre><code>#pragma once
  
  class Configuracion
  {
  public:
      static int MAX_ATAQUES;
      static int DIV_TERRITORIOS;
  };
  
  int Configuracion::MAX_ATAQUES = 5;
  int Configuracion::DIV_TERRITORIOS = 3;
  </code></pre>
  
  <p>What I want is to be able to modify or read the values from the other classes. I can't declare a static variable and define it in the declaration. I can't let that variables without definition either because I get "Unresolved External" errors.</p>
  
  <pre><code>1&gt;JugadorIA.obj : error LNK2005: "public: static int Configuracion::MAX_ATAQUES" \
           (?MAX_ATAQUES@Configuracion@@2HA) already defined in JugadorHumano.obj
  1&gt;JugadorIA.obj : error LNK2005: "public: static int Configuracion::DIV_TERRITORIOS" \
           (?DIV_TERRITORIOS@Configuracion@@2HA) already defined in JugadorHumano.obj
  1&gt;Main.obj : error LNK2005: "public: static int Configuracion::MAX_ATAQUES" \
           (?MAX_ATAQUES@Configuracion@@2HA) already defined in JugadorHumano.obj
  1&gt;Main.obj : error LNK2005: "public: static int Configuracion::DIV_TERRITORIOS" \
           (?DIV_TERRITORIOS@Configuracion@@2HA) already defined in JugadorHumano.obj
  1&gt;PartidaClasica.obj : error LNK2005: "public: static int Configuracion::MAX_ATAQUES" \
           (?MAX_ATAQUES@Configuracion@@2HA) already defined in JugadorHumano.obj
  1&gt;PartidaClasica.obj : error LNK2005: "public: static int Configuracion::DIV_TERRITORIOS" \
           (?DIV_TERRITORIOS@Configuracion@@2HA) already defined in JugadorHumano.obj
  1&gt;PartidaMision.obj : error LNK2005: "public: static int Configuracion::MAX_ATAQUES" \
           (?MAX_ATAQUES@Configuracion@@2HA) already defined in JugadorHumano.obj
  1&gt;PartidaMision.obj : error LNK2005: "public: static int Configuracion::DIV_TERRITORIOS" \
           (?DIV_TERRITORIOS@Configuracion@@2HA) already defined in JugadorHumano.obj
  1&gt;D:\Leire\My Dropbox\Carpetas compartidas\Compartidos Victor\Practicas POO II\P3\P3M10\Debug\P3M10.exe : fatal error LNK1169: one or more multiply defined symbols found
  </code></pre>
  
  <p>What should I do to avoid this redefinition I get? I can't figure it out and I can't find a similar problem.</p>