错误 C1191

只能在全局范围内导入“dl”

将 mscorlib.dll 导入使用 /clr 编程的程序中的说明不能出现在命名空间或函数中,但必须出现在全局范围内。

以下示例将生成 C1191:

// C1191.cpp
// compile with: /clr
namespace sample {
   #using <mscorlib.dll>   // C1191 not at global scope
}

可能的解决方法:

// C1191b.cpp
// compile with: /clr /c
#using <mscorlib.dll>
namespace sample {}