名称后跟“::”必须是类或命名空间名称 (C++/CLI)

问题描述 投票:0回答:0
#include<stdlib.h>
#include<string.h>
#include<msclr\marshal.h>

using namespace System;
using namespace msclr::interop; //error on this line

const char* message = "Test String to Marshal";
String^ result;
result = marshal_as<String^>( message );
return 0;

上面的代码在 CLI 应用程序上完美运行,但在 Windows 窗体应用程序上运行不正常。我正在使用 Visual Studio Express 2012 版。为什么会发生这种事?我在项目设置中启用了 CLR 和多字节字符字节。请回答这个问题,我在这段代码上停留了一个多小时。预先感谢。

c++ .net visual-c++ visual-studio-2012 c++-cli
© www.soinside.com 2019 - 2024. All rights reserved.