如何将C ++库导入Xcode Objective C项目?

时间:2021-12-13 22:54:11

I'm new to developing apps for OSX. I want to write a library that does a specific job in C++ and use it inside my XCode Objective-C/Objective-C++ project.

我是开发OSX应用程序的新手。我想编写一个用C ++完成特定工作的库,并在我的XCode Objective-C / Objective-C ++项目中使用它。

How should I compile and prepare the C++ library so it can be imported into XCode?

我应该如何编译和准备C ++库,以便将其导入XCode?

2 个解决方案

#1


1  

There are Xcode templates for C++ libraries. Just make one of those and copy the library's source into it.

有用于C ++库的Xcode模板。只需制作其中一个并将库的源复制到其中。

#2


0  

You need to set Compile Sources As: Objective-C++ in your build settings.

您需要在构建设置中将Compile Sources设置为:Objective-C ++。

#1


1  

There are Xcode templates for C++ libraries. Just make one of those and copy the library's source into it.

有用于C ++库的Xcode模板。只需制作其中一个并将库的源复制到其中。

#2


0  

You need to set Compile Sources As: Objective-C++ in your build settings.

您需要在构建设置中将Compile Sources设置为:Objective-C ++。