0

It seems this has been asked before, however I have not found an answer that works for me.

Setup: I am currently creating two static library, that are used in a project. So lets say I have Project, Liba and Libb. Project links to both Liba and Libb, Libb has an import tag for Liba. Project does not directly use Liba, but I have it in the workspace because I have read that we are not supposed to have a library directly link another library. Surprisingly this all works. Where I run into issues is that I want Libb to also use StackMob. For some reason Libb can't find StackMob.h when importing. I have added the Stackmob library to my workspace in a similar way I have for my other libraries.

Here are the relevant code snippets of each class.

Project.h

#import "Libb/Libb.h"

@interface project
{
    Libb* _libb;
}
@end

Project.m

@implementation Project
{
    _libb = [[Libb alloc] init];
}
@end

Libb.h

@class Liba
@class StackMob

@interface Libb
{
    Liba* _liba;
}
@end

Libb.m

#import "Liba/Liba.h"
#import "Stackmob.h"    //This is where I get the error. I have also tried "StackMob/StackMob.h"

@implementation Libb
{
    //Code here....
}

Thanks for the help. If you need me to clarify, please ask. I realize some of the code I provided is not necessary, but I thought it may help understanding how I have things setup.

n01d3a
  • 17
  • 5

1 Answers1

0

Add $(SRCROOT)/../StackMob/Headers to Header Search Paths in build settings to allow the project to find the header files.

Tom Redman
  • 5,592
  • 4
  • 34
  • 42
  • I have already tried that. It says Stackmob.h can't be found. – n01d3a Aug 29 '13 at 14:27
  • Does LibB have any reference to the location of StackMob in its `Build Settings` > `Header Search Paths` field? Check to see what LibA does in this area to get access to the .h file. – Tom Redman Aug 29 '13 at 14:35
  • LibB > Build Settings > Header Search Paths is empty. The only difference I see is that Project contains the project for LibA, whereas thats not possible for StackMob since I am obviously not the creator. – n01d3a Aug 29 '13 at 14:41
  • The StackMob library should come with header files. Have you seen the [configuration instructions](https://developer.stackmob.com/ios-sdk/configure)? You pull the whole folder into your project, which will include the header file(s), and then you can `#import "StackMob.h". You can place the library and its headers somewhere common, and point both LibA and LibB to it (using Header Search Paths to find the headers). – Tom Redman Aug 29 '13 at 14:46
  • I have followed the directions, and to prove that to myself I did a small test. I am able to use #import "StackMob.h" in my project.m file without issues. So, I have to change Header Search Path? ok, Ill try that and respond. – n01d3a Aug 29 '13 at 14:49
  • Did you have any luck? – Tom Redman Aug 30 '13 at 15:54
  • After messing around with the settings, I have been able to get it to compile. Since you are the only one who helped, and got me in the correct direction, if you change your answer I will mark it as the answer. I had to add "$(SRCROOT)/../StackMob/Headers" to "Header Search Path". Although it compiles, I know get two warnings: It tells me that two of the frameworks that I have added are not found. I will work on this though. – n01d3a Aug 31 '13 at 16:21