EDN Admin
Well-known member
Hello everyone,<br/> <br/> I am having some problems with namespaces in the application that I am developing (I am using Visual C++ 2008 in Windows XP).<br/> <br/> First of all I declared the class CM_Unit inside unit namespace:<br/> <br/> <br/> namespace unit {<br/> <br/> // Classe abstrata que direciona a implementação das Units a serem utilizadas pelo BSP<br/> class CM_Unit<br/> {<br/> protected:<br/> // [Unit class code]<br/> <br/> };<br/> }<br/> <br/> then I declared the class WS_Match unit which is a child class from the CM_Unit class and is inside the namespace web_service_match_unit. This namespace is inside the unit namespace.<br/> <br/> #include <stdafx.h><br/> #include "CM_Unit.h"<br/> <br/> #include "WsBiometriaH.h"<br/> <br/> #include "BirSerializer.h"<br/> <br/> using namespace unit::web_service_match_unit::util;<br/> <br/> namespace unit {<br/> namespace web_service_match_unit {<br/> <br/> <br/> WS_MATCH_UNIT_EXPORT class WS_MatchUnit : public CM_Unit<br/> {<br/> // WS_MatchUnit code....<br/> };<br/> }<br/> }<br/> <br/> Then I declared the class BIRSerializer inside the namespace util, which is inside the namespace web_service_match_unit.<br/> <br/> namespace unit {<br/> namespace web_service_match_unit {<br/> namespace util {<br/> <br/> class BirSerializer<br/> {<br/> // BirSerializer code...<br/> };<br/> }<br/> }<br/> }<br/> <br/> The problem is that when I build my program I keep getting the linker errors below:<br/> <br/> dllmain.obj : error LNK2005: _namespaces already defined in BirSerializer.obj<br/> stdafx.obj : error LNK2005: _namespaces already defined in BirSerializer.obj<br/> WS_MatchUnit.obj : error LNK2005: _namespaces already defined in BirSerializer.obj<br/> <br/> Please help me.<br/> <br/> Thanks,<br/> Komyg
View the full article
View the full article