0
#include "missing.h"

I have a library that have missing.h header file which in Full version of the framework I include that library but in lite version I don't want to link that library..

But in objective c when you include missing file it will not continue building it will show an errors that the header "missing.h" is not found.

How can I work around this problem? like to say if the header not found don't include it at all

3
  • You cannot. It's a fatal error. Commented Mar 16, 2015 at 13:50
  • How do you switch between "lite" and "full" version? Different targets? Commented Mar 16, 2015 at 14:07
  • Yes I made different target for each version Commented Mar 16, 2015 at 14:13

2 Answers 2

1

You could use preprocessor directives.

#if FULL_VERSION
#include "missing.h"
#endif
Sign up to request clarification or add additional context in comments.

5 Comments

Thanks I will try with your suggestion
I tried it .. yes it works fine thanks .. but like what @DuncanC said I need to remove the library from being linked .. and I can't figured out how to do that in a dynamic way .. like depending on configuration file or something!
You can set up a second target in your project's configuration. In the second target, simply remove the link.
Yes but it will make the structure a little bit complicated like I will have a lot of targets and when trying to build it shows me a lot of build errors while there is no ordering for dependencies until getting it correctly.. I don't know some one suggest me to see cmake .. I don't know if it will help me Thanks a lot
Why would you have a lot of targets? There's one for full and one for lite.
0

Ian's answer is good if you really need to not include the header.

Note that #importing the header does not mean that the binary for the library is included in your project, and conversely, not importing the header does not prevent the library's binary from being linked into your project.

The more important thing is changing the build phases step of your "lite" target so it doesn't copy the library into your "lite" application.

1 Comment

From build phase I am linking the binaries of my libraries to the main framework static library.. Thanks it is really important point

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.