zoukankan      html  css  js  c++  java
  • [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 {

    };

    }

  • 相关阅读:
    前序中序输出后序
    Blah数集
    中缀表达式转后缀表达式 (栈)
    1357:车厢调度 (栈)
    最长公共上升子序列 (LIS+LCS+记录)
    1481:Maximum sum (前缀和+dp)
    8464:股票买卖
    7627:鸡蛋的硬度
    2989:糖果
    U33405 纽约 (二分)
  • 原文地址:https://www.cnblogs.com/taoxu0903/p/1862475.html
Copyright © 2011-2022 走看看