2

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.

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

Roman
  • 10,309
  • 17
  • 66
  • 101
  • It would probably help to know how the library is currently being built. Manual makefile, autotools, Visual Studio, some other build system, as part of another, non-XCode application etc.? – pmdj Jan 17 '12 at 12:00
  • @pmjordan, I'm not quite sure which is the way to go. I prefer writing the library code in Visual Studio but makefile is okay too. Any help is appreciated. – Roman Jan 17 '12 at 12:06
  • Oh okay, so it's not existing code you want to import. XCode has target templates for static and dynamic libraries, I suggest you use the one that suits you better (static is probably easier). – pmdj Jan 18 '12 at 09:08

2 Answers2

1

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

bames53
  • 86,085
  • 15
  • 179
  • 244
0

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

mskw
  • 10,063
  • 9
  • 42
  • 64