I would like to use a C++ class in an objective c application. How to achieve this?
我希望在目标C应用程序中使用c++类。如何实现呢?
Thanks for your helps :)
谢谢你的帮助。
1 个解决方案
#1
4
You can do this using "Objective-C++". You should read Apple's documentation, but the short version is that you may mix C++ and Objective-C in files with the extension ".mm". It's not magic (C++ classes and Objective-C classes are still separate things), but you can now use them in the same code.
您可以使用“Objective-C++”来实现这一点。您应该阅读苹果的文档,但简短的版本是您可以将c++和Objective-C文件与扩展名“.mm”混合在一起。它并不神奇(c++类和Objective-C类仍然是分开的),但是您现在可以在相同的代码中使用它们。
#1
4
You can do this using "Objective-C++". You should read Apple's documentation, but the short version is that you may mix C++ and Objective-C in files with the extension ".mm". It's not magic (C++ classes and Objective-C classes are still separate things), but you can now use them in the same code.
您可以使用“Objective-C++”来实现这一点。您应该阅读苹果的文档,但简短的版本是您可以将c++和Objective-C文件与扩展名“.mm”混合在一起。它并不神奇(c++类和Objective-C类仍然是分开的),但是您现在可以在相同的代码中使用它们。