且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何使用C ++ / CLI在C#应用程序

更新时间:2023-02-12 12:16:41

好了,好了,我现在觉得愚蠢。

Okay, well, I now feel dumb.

事实证明,这个问题我是有(这是我解决了一个几个星期前 - 只是抽时间去更新这个答案)是,我已经包含头文件(见克里斯的答案是),但我就没'牛逼实际上包括CPP文件(里面是空的以外,包括头文件)。

It turns out that the problem I was having (which I solved a couple weeks ago - just got around to updating this answer) was that I had included the header file (see Chris' answer for that), but I hadn't actually included the CPP file (which is empty other than including the header file).

在我这样做,该DLL编译正确,我可以调用C ++函数从我的C#code(使用C ++ / CLI)。

Once I did this, the DLL compiled correctly and I could call the C++ functions (using C++/CLI) from my C# code.