Archive for 20 8 月, 2015

解决VC2008编译C/C++混合代码出现D8045错误的问题

星期四, 20 8 月, 2015

使用Visual Studio 2008编译VC程序,如果窗体上需要引入一个C#编写的UserControl,那么必须在引入程序的代码*.h文件包含afxwinforms.h文件,比如:
[csharp]
#pragma once
#include <afxwinforms.h>

#using “..\Bin\MyUserControl.dll” // C# UserControl assembly
[/csharp]

包含afxwinforms.h必须选择“/clr”选项,即要选中Configuration Properties->General下的“Common Language Runtime Support (/clr)”。

(更多…)