msclr/marshal.h が無い。
Posted: 2017年9月23日(土) 12:10
[1] 質問文
[1.1] msclr/marshal.h が無い。
[1.2] 以下記述
[1.3] 1>.\list-11-3-2.cpp(5) : fatal error C1083: include ファイルを開けません。'msclr/marshal.h': No such file or directory
[1.4] msclr/marshal.h の入手方法を知りたい。
[2] 環境
[2.1] OS : Windows 10
[2.2] コンパイラ名 : VC++ 2008EE
[3] その他
・C言語初歩
[1.1] msclr/marshal.h が無い。
[1.2] 以下記述
[1.3] 1>.\list-11-3-2.cpp(5) : fatal error C1083: include ファイルを開けません。'msclr/marshal.h': No such file or directory
[1.4] msclr/marshal.h の入手方法を知りたい。
[2] 環境
[2.1] OS : Windows 10
[2.2] コンパイラ名 : VC++ 2008EE
[3] その他
・C言語初歩
// list-11-3-2.cpp : メイン プロジェクト ファイルです。
#include "stdafx.h"
#include <iostream>
#include <msclr/marshal.h> // マーシャリング用
using namespace System;
using namespace std;
using namespace msclr::interop; // マーシャリング用
int main(array<System::String ^> ^args)
{
char * cstr = "Hello/char";
cout << "char * --> " << cstr << endl;
String ^ Str = marshal_as<String ^>(cstr);
Console::WriteLine("String --> " + Str);
String ^ Str1 = %String("Hello/String");
Console::WriteLine("String --> " + Str1);
marshal_context ^ context = gcnew marshal_context();
const char * cstr1 = context->marshal_as<const char *>(Str1);
cout << "char * --> " << cstr1 << endl;
Console::WriteLine();
Console::WriteLine("Enterキーを押して終了。");
Console::ReadLine();
return 0;
}