error C2393: 'c' : per-appdomain symbol cannot be allocated in segment 'Shared'

ernst20020530 2009-03-21 03:44:31
#include "stdafx.h"
#include "windows.h"
#include <memory.h>
#include <TCHAR.h>
#pragma once


#pragma data_seg("Shared")
volatile wchar_t content[200]=TEXT("abc");
#pragma data_seg()
#pragma comment(linker, "/Section:Shared,RWS")

報錯:error C2393: 'c' : per-appdomain symbol cannot be allocated in segment 'Shared'

怎么更改/clr ?
...全文
125 6 打赏 收藏 转发到动态 举报
写回复
用AI写文章
6 条回复
切换为时间正序
请发表友善的回复…
发表回复
ernst20020530 2009-03-23
  • 打赏
  • 举报
回复
不能用const,因為我要改動的
  • 打赏
  • 举报
回复
没遇到过,up下
sendto66 2009-03-21
  • 打赏
  • 举报
回复
不懂,up
野男孩 2009-03-21
  • 打赏
  • 举报
回复
The use of appdomain variables implies that you are compiling with /clr:pure or /clr:safe, and a safe or pure image cannot contain data segments.

要用共享的data segments,貌似就不能用/clr的编译项。。。
「已注销」 2009-03-21
  • 打赏
  • 举报
回复
volatile wchar_t content[200]=TEXT("abc");
改成:
const wchar_t content[200]=TEXT("abc");

65,211

社区成员

发帖
与我相关
我的任务
社区描述
C++ 语言相关问题讨论,技术干货分享,前沿动态等
c++ 技术论坛(原bbs)
社区管理员
  • C++ 语言社区
  • encoderlee
  • paschen
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
  1. 请不要发布与C++技术无关的贴子
  2. 请不要发布与技术无关的招聘、广告的帖子
  3. 请尽可能的描述清楚你的问题,如果涉及到代码请尽可能的格式化一下

试试用AI创作助手写篇文章吧