proyecto en VC 6
Publicado por Miguwk (3 intervenciones) el 28/03/2006 18:21:36
en mi proyecto de VC6 tengo varios archivos cpp y h
en un archivo llamada megaman.h
tengo esto
bool hTileCollision = false;
al hacer en otro archivo
#include "megaman.h" y querer compilar en enlazador me manda esto
hscroll.obj : error LNK2005: "bool hTileCollision" (?hTileCollision@@3_NA) already defined in cutman.obj
main.obj : error LNK2005: "bool hTileCollision" (?hTileCollision@@3_NA) already defined in cutman.obj
megaman.obj : error LNK2005: "bool hTileCollision" (?hTileCollision@@3_NA) already defined in cutman.obj
mscreen.obj : error LNK2005: "bool hTileCollision" (?hTileCollision@@3_NA) already defined in cutman.obj
Release/megaman remake.exe : fatal error LNK1169: one or more multiply defined symbols found
Error executing link.exe.
si hago
static bool hTileCollision = false;
todo va bien, pero no puedo acceder a esta variable desde otros archivos fuentes, pues es static osea privada solo al archivo fuente dond esta declarado
¿ como pudeo solucionar esto ?, pues necesito accedes a estar variable desdeotros archivos fuentes
en un archivo llamada megaman.h
tengo esto
bool hTileCollision = false;
al hacer en otro archivo
#include "megaman.h" y querer compilar en enlazador me manda esto
hscroll.obj : error LNK2005: "bool hTileCollision" (?hTileCollision@@3_NA) already defined in cutman.obj
main.obj : error LNK2005: "bool hTileCollision" (?hTileCollision@@3_NA) already defined in cutman.obj
megaman.obj : error LNK2005: "bool hTileCollision" (?hTileCollision@@3_NA) already defined in cutman.obj
mscreen.obj : error LNK2005: "bool hTileCollision" (?hTileCollision@@3_NA) already defined in cutman.obj
Release/megaman remake.exe : fatal error LNK1169: one or more multiply defined symbols found
Error executing link.exe.
si hago
static bool hTileCollision = false;
todo va bien, pero no puedo acceder a esta variable desde otros archivos fuentes, pues es static osea privada solo al archivo fuente dond esta declarado
¿ como pudeo solucionar esto ?, pues necesito accedes a estar variable desdeotros archivos fuentes
Valora esta pregunta


0