How to link Cocoa static library with C command line target?

I have a static target library that uses Foundation classes (NSArray, etc.). I want to use this static library in the target command line tool. The command line tool contains only C files. From the command line tool, I want to call a method exported to a static library. So I changed the header search path and linked the static library. When I compile a command line tool, it follows linker errors.


Undefined symbols:
"_OBJC_CLASS_$_NSMutableArray", referenced from:
"_objc_msgSend", referenced from:
What is the method to link a static library which uses Foundation classes from a command line tool which contains C files?

Hi

Devara Goodda

+3
source share
1 answer

Add the Foundation Foundation to your project and to the build phase of the link libraries in your target environment. The easiest way to do the latter is to get information about the goal; there is a list of linked libraries on the General tab of this window.

+2
source

Source: https://habr.com/ru/post/1734667/


All Articles