[Tip: using namespace in C++/CLI]
In a managed C++ project, we can use the “using namespace” expression to include managed types. Just like using “#include” incorrectly will cause some compile error, declaring “using namespace” globally will cause some problems too. We encountered “ambiguous symbol” error when integrating ASM 4100. To resolve the issue, we can make the “using namespace” impact locally.
For example. The following code may have “ambiguous symbols” error:
// FIExternalDatabaseInfo.h using namespace System;
namespace Autodesk { namespace Catalyst { namespace Freeway { namespace Components { namespace FIExternalDatabaseInfo {
public ref class ExternalDatabaseInfo { } } |
We can resolve it by using System namespace inside Autodesk::Catalyst::Freeway::Components::FIExternalDatabaseInfo only:
namespace Autodesk { namespace Catalyst { namespace Freeway { namespace Components { namespace FIExternalDatabaseInfo { using namespace System;
public ref class ExternalDatabaseInfo { }; }
|