daily pastebin goal
68%
SHARE
TWEET

Untitled

a guest Aug 10th, 2018 63 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. Link error when declaring public static variables in C  
  2. #pragma once
  3.  
  4. class Configuracion
  5. {
  6. public:
  7.     static int MAX_ATAQUES;
  8.     static int DIV_TERRITORIOS;
  9. };
  10.  
  11. int Configuracion::MAX_ATAQUES = 5;
  12. int Configuracion::DIV_TERRITORIOS = 3;
  13.    
  14. 1>JugadorIA.obj : error LNK2005: "public: static int Configuracion::MAX_ATAQUES"
  15.          (?MAX_ATAQUES@Configuracion@@2HA) already defined in JugadorHumano.obj
  16. 1>JugadorIA.obj : error LNK2005: "public: static int Configuracion::DIV_TERRITORIOS"
  17.          (?DIV_TERRITORIOS@Configuracion@@2HA) already defined in JugadorHumano.obj
  18. 1>Main.obj : error LNK2005: "public: static int Configuracion::MAX_ATAQUES"
  19.          (?MAX_ATAQUES@Configuracion@@2HA) already defined in JugadorHumano.obj
  20. 1>Main.obj : error LNK2005: "public: static int Configuracion::DIV_TERRITORIOS"
  21.          (?DIV_TERRITORIOS@Configuracion@@2HA) already defined in JugadorHumano.obj
  22. 1>PartidaClasica.obj : error LNK2005: "public: static int Configuracion::MAX_ATAQUES"
  23.          (?MAX_ATAQUES@Configuracion@@2HA) already defined in JugadorHumano.obj
  24. 1>PartidaClasica.obj : error LNK2005: "public: static int Configuracion::DIV_TERRITORIOS"
  25.          (?DIV_TERRITORIOS@Configuracion@@2HA) already defined in JugadorHumano.obj
  26. 1>PartidaMision.obj : error LNK2005: "public: static int Configuracion::MAX_ATAQUES"
  27.          (?MAX_ATAQUES@Configuracion@@2HA) already defined in JugadorHumano.obj
  28. 1>PartidaMision.obj : error LNK2005: "public: static int Configuracion::DIV_TERRITORIOS"
  29.          (?DIV_TERRITORIOS@Configuracion@@2HA) already defined in JugadorHumano.obj
  30. 1>D:LeireMy DropboxCarpetas compartidasCompartidos VictorPracticas POO IIP3P3M10DebugP3M10.exe : fatal error LNK1169: one or more multiply defined symbols found
  31.    
  32. #include "Configuracion.h"
  33.  
  34. int Configuracion::MAX_ATAQUES = 5;
  35. int Configuracion::DIV_TERRITORIOS = 3;
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top