Hi Everyone,
Reference
https://github.com/weidai11/cryptopp/issues/447.
We are (were) catching a compile problem after moving to CryptoPP::byte. The problem is manifested in test.cpp. 'main' must not be in a namespace, so the source file has a 'using namespace CryptoPP'.
The problem is, Microsoft Window Kits put a byte in the global namespace, and its causing "error C2872: 'byte' : ambiguous symbol". We triaged the issue for the moment at
https://github.com/weidai11/cryptopp/commit/00e133745663f2. The 00e13374 commit surgically applies 'using CryptoPP::byte', but it
feels like a hack due to the source of the problem. Its not a multiple
inheritance problem; rather, its a global namespace pollution problem.
My question is, is there a best practice around main and scoping?
Should we create a second, 'scoped_main':
// no namespace
int main(int argc, char* argv[])
{
return CryptoPP::Test::scoped_main(argc, argv);
}
NAMESPACE_BEGIN(CryptoPP)
NAMESPACE_BEGIN(Test)
int scoped_main(int argc, char* argv[])
{
// What 'main' used to be
...
}
NAMESPACE_END
NAMESPACE_END
Or is adding CryptoPP:: and CryptoPP::Test:: to everything our only other option?
Or maybe something else?
Jeff