guyver6 Posted January 10, 2006 Report Share Posted January 10, 2006 (edited) Opening this topic to clean our code from uglyness of ::String declarations. Now, thanks to that little code snippet, we no longer need to specify String's scope. ::String explicitly tells the compiler that we want String type that is defined in global scope (and that is our String type). Since two more projects we're using have classes with the same names, but in other namespaces (CEGUI::String and Ogre::String), this led to ambiguous symbol errors when one of us wanted to use using namespace Ogre; // or CEGUI to ease writting. Since our code is in Xenocide::Common/Core/UI namespaces, after saying using namespace Ogre in example, we had in our namespace equal access to String types defined in Ogre or CEGUI and in global scope. This led to errors when we had written String when declaring type. Solution was to explicitly specify which type we want to use, that is writting the ugly ::String stuff. This led to errors on GCC, since GCC treats <: as so we were forced to write>TemplateClass< ::String> to make code portable. This all makes code unreadable. So, now that the issue is fixed, and that even if you write using namespace Ogre; you have to explicitly tell Ogre::String, we can convert all ::String to String. So, I ask you, if you see somewhere ::String - change it to String and make sure code compiles. Also, if you see using namespace Ogre; or CEGUI in all definitions of methods of some class, move that to the beginning of .cpp file. Changing ::String to String can also be done in .h files. Btw, remember that it's forbidden to use using.... declarations in header files (the ones in commonrequisites.h are there to fix ::String issue so it doesn't count ). Greetings,Guyver Edited January 10, 2006 by guyver6 Link to comment Share on other sites More sharing options...
UnFleshed One Posted January 11, 2006 Report Share Posted January 11, 2006 Cheers for that one Link to comment Share on other sites More sharing options...
Guest Azrael Posted January 11, 2006 Report Share Posted January 11, 2006 http://img381.imageshack.us/img381/2851/hatestrign9hr.gif Link to comment Share on other sites More sharing options...
UnFleshed One Posted January 11, 2006 Report Share Posted January 11, 2006 I did a bit of purging, so now there are no ::Strings (One full rebuild more, one less... ). It compiles and runs, but I might have replaced something extra, so keep your eyes open Link to comment Share on other sites More sharing options...
Recommended Posts