tags:

views:

89

answers:

2

I have a target that uses classes from a static library (.a file).

I have the static library in XCode and it is required for the target and is in the "Linked Libraries" section.

In the code I use a class from the static library like:

#include "class_from_static.h"

But XCode complains that the file "class_from_static.h" is not found. Shouldn't it find it?

I have verified that the static library does indeed contain this class.

What is the issue?

+1  A: 

As well as telling the linker where to find the static library, you must tell the compiler where to find the header files. Adding the header files to the project also adds them to the compiler's search path.

Graham Lee
+1  A: 

Static libraries aren't like frameworks; they only contain code, not headers. You need to add the folder containing class_from_static.h to your user header search paths, or just add the header file directly to the project. If you double-click the setting you can drag and drop a folder into the list.

Nicholas Riley