简体   繁体   English

当 Microsoft 文档仅包含 C# 示例时如何查找 C++ 包含文件名

[英]How to find c++ include file names when Microsoft documentation only includes C# examples

When MSDN only contains C# examples, and I am trying to code C++, how can I find the names of the required include files?当 MSDN 仅包含 C# 示例,而我正在尝试编写 C++ 代码时,如何找到所需包含文件的名称? For example, I want to write some C++ code that uses the TextPointer class , how do I find the #include statements that are required?例如,我想编写一些使用TextPointer类的C++ 代码,如何找到所需的#include语句?

TextPointer is a .NET class. TextPointer是一个 .NET 类。 C++Builder does not support .NET development, which is why its compiler can't find any .NET related C++ header files - they don't exist in C++Builder's runtime libraries. C++Builder 不支持 .NET 开发,这就是为什么它的编译器找不到任何与 .NET 相关的 C++ 头文件的原因——它们不存在于 C++Builder 的运行时库中。

The only way you can use .NET classes in C++Builder projects is if either:您可以在 C++Builder 项目中使用 .NET 类的唯一方法是:

  • the .NET classes are COM compatible (ie, have the [ComVisible(true)] attribute), then C++Builder code can create instances of the appropriate COM objects. .NET 类是 COM 兼容的(即,具有[ComVisible(true)]属性),然后 C++Builder 代码可以创建适当的 COM 对象的实例。

  • you wrap your .NET code in a DLL written in Visual Studio, and have it export a C compatible interface so C++Builder code can then use it.您将 .NET 代码包装在用 Visual Studio 编写的 DLL 中,并让它导出 C 兼容接口,以便 C++Builder 代码可以使用它。

  • you use a 3rd party framework, like CrossTalk or Hydra , that allows C++Builder code to host the .NET runtime and use .NET assemblies and types as-is.您使用第 3 方框架,如CrossTalkHydra ,它允许 C++Builder 代码托管 .NET 运行时并按原样使用 .NET 程序集和类型。

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

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