简体   繁体   English

在带有 VS express 1013 的 c++ 项目中使用 c# 接口

[英]Using c# interface in a c++ project with VS express 1013

I am trying to include ac# interface into a c++ header file which belongs to a clr library.我正在尝试将 ac# 接口包含到属于 clr 库的 c++ 头文件中。 I add the additional directory and as soon as I include the interface and try to build the c++ project, I get loads of errors leading to the cs file, like:我添加了附加目录,一旦我包含接口并尝试构建 c++ 项目,我就会收到大量导致 cs 文件的错误,例如:

在此处输入图片说明

Do I mess up some VS settings?我是否搞砸了一些 VS 设置?

It is impossible to #include "IImagesToVideoConverter.cs". #include "IImagesToVideoConverter.cs" 是不可能的。 The C++ compiler cannot understand c# code. C++ 编译器无法理解 c# 代码。 You need to put ac# project and a c++ project in the same solution, reference the c# project from the c++ project, and (i think) #using <the.dll>您需要将 ac# 项目和 c++ 项目放在同一个解决方案中,从 c++ 项目中引用 c# 项目,并且(我认为) #using <the.dll>

including a C# source in a C++ compile makes no sense.在 C++ 编译中包含 C# 源代码毫无意义。 They are different languages, why would you ever expect this to work?它们是不同的语言,为什么您会期望它起作用?

Perhaps you want to make a COM interface between them, in which case you use a #import directive.也许您想在它们之间建立一个 COM 接口,在这种情况下,您可以使用#import指令。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM