编译器警告(等级 1)C4944

“symbol”:无法从“assembly1”导入符号,因为当前范围内已存在“symbol”

在源代码文件中定义了符号,然后 #using 语句引用了也已定义该符号的程序集。 程序集中的符号将被忽略。

示例

下面的示例使用一个名为 ClassA 类型创建了一个组件。

// C4944.cs
// compile with: /target:library
// C# source code to create a dll
public class ClassA {
   public int i;
}

以下示例生成 C4944。

// C4944b.cpp
// compile with: /clr /W1
class ClassA {
public:
   int u;
};

#using "C4944.dll"   // C4944 ClassA also defined C4944.dll

int main() {
   ClassA * x = new ClassA();
   x->u = 9;
   System::Console::WriteLine(x->u);
}