//unnamed.hpp...namespace{class A{ public: void somefunc();};}...//A.cpp#include "unnamed.hpp"void someuniqueidentifier::A::somefunc(){...}//Facade.cpp#include "unnamed.hpp"#include "Facade.hpp"void Facade::somefunc(){anotheruniqueidentifier::A instance;instance.somefunc();}
Since the unique identifier is different in each translation unit, you have ended up defining a class that belongs to a different namespace than you have used, and so you will get a linker error .
Only way you could solve this is by defining the unnamed namespace objects inside the unnamed namespace.
[edited by - Jingo on February 21, 2004 6:49:12 AM]