C++ cli 转换标准C++;整型到字符串^

C++ cli 转换标准C++;整型到字符串^,c++-cli,C++ Cli,我想在Visual C++/CLI环境中将std::int转换为System::String^。我知道我们可以使用Microsoft提供的库,其中包含模板函数marshal_作为 #include <msclr\marshal.h> using namespace msclr::interop; int count = 1; String^ Apple; Apple = marshal_as<String^>(count); #包括 使用名称空间msclr::int

我想在Visual C++/CLI环境中将std::int转换为System::String^。我知道我们可以使用Microsoft提供的库,其中包含模板函数marshal_作为

#include <msclr\marshal.h>

using namespace msclr::interop;

int count = 1;
String^ Apple;
Apple = marshal_as<String^>(count);
#包括
使用名称空间msclr::interop;
整数计数=1;
苹果串;
苹果=元帅(计数);
由于出现此错误,我无法运行此语句

'msclr::interop::error_reporting_helper<_To_Type,_From_Type,false>::marshal_as':
 This conversion is not supported by the library or the header file needed for 
this conversion is not included.
'msclr::interop::error\u reporting\u helper::marshal\u as':
所需的库或头文件不支持此转换
不包括此转换。

封送作为
用于在本机类型和其托管等效类型之间进行转换。它不是一个通用的“将任何东西转换为任何东西”工具。若要将整数转换为.NET<代码>字符串,可以使用<代码> STD::ToString 转换为C++字符串,然后将代码> MARSALLY作为< /COD> > <代码>字符串如果您想在.NET端进行转换,也可以使用
Int.ToString

封送作为
用于在本机类型及其托管等效类型之间进行转换。它不是一个通用的“将任何东西转换为任何东西”工具。若要将整数转换为.NET <代码>字符串,可以使用转换为C++字符串,然后将代码> MARSALLIX作为< /COD> > <代码>字符串,否则,如果您想进行转换.NET侧,则使用<代码> .ToString 字符串Str< <代码>不是C++中的有效类型。你是说C++/CLI吗?是的,C++/CLI。感谢改正<代码>字符串^ 不是C++中的有效类型。你是说C++/CLI吗?是的,C++/CLI。谢谢你的更正
int count = 100; 
System::String^ s = count.ToString();