【发布时间】:2018-03-30 12:49:32
【问题描述】:
我想在 Visual C++/CLI 环境中将 std::int 转换为 System::String^。我知道我们可以使用微软提供的包含模板函数 marshal_as 的库
#include <msclr\marshal.h>
using namespace msclr::interop;
int count = 1;
String^ Apple;
Apple = marshal_as<String^>(count);
由于出现此错误,我无法运行此语句
'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.
【问题讨论】:
-
String^不是 C++ 中的有效类型。你是说 C++/CLI 吗? -
是的 C++/CLI。感谢指正
标签: c++-cli