编译器错误 C2393

“symbol”:不能在“segment”段中分配 per-appdomain 符号

备注

“/clr:pure”和“/clr:safe”编译器选项在 Visual Studio 2015 中已弃用,并且在 Visual Studio 2017 中不受支持

使用 appdomain 变量意味着正在使用 /clr:pure 或 /clr:safe 进行编译,并且安全或纯映像不能包含数据段

有关详细信息,请参阅 /clr(公共语言运行时编译)

示例

以下示例生成 C2393。 若要解决此问题,请不要创建数据段。

// C2393.cpp
// compile with: /clr:pure /c
#pragma data_seg("myseg")
int n = 0;   // C2393