简体   繁体   English

是否可以在 Xcode 的 C++ 项目中包含框架?

[英]Is it possible to include framework in C++ project in Xcode?

I have a C++ project generated from Cmake to Xcode.我有一个从 Cmake 生成到 Xcode 的 C++ 项目。 My project is just some static and dynamic libraries.我的项目只是一些静态和动态库。 I want to include some 3rd party frameworks to it.我想在其中包含一些 3rd 方框架。 Is it possible?是否可以? Is there any chance to include?有机会加入吗? Or I should completely redesign the project to Cocoa app?或者我应该将项目完全重新设计为 Cocoa 应用程序? I haven't access to the framework source code.我无法访问框架源代码。 Work with Xcode 9.2.使用 Xcode 9.2。

No, you can't use Cocoa frameworks in pure C++ project.不,你不能在纯 C++ 项目中使用 Cocoa 框架。

But you can just create an obj-c project and include all of your existing sources inside - everything will work.但是您可以创建一个 obj-c 项目并在其中包含您现有的所有源 - 一切都会正常进行。 Just remember to use .mm extension for the source files, calling C++ code.请记住对源文件使用.mm扩展名,调用 C++ 代码。

You can use swift as well, but that will require to create a wrapper for C++ code.您也可以使用 swift ,但这需要为 C++ 代码创建一个包装器。

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

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