简体   繁体   中英

#ifdef doesn't seem to work with my framework

I have a framework that uses two other frameworks, all of which I have made myself.

One of the used frameworks has a few classes with an #ifdef NEED_THIS_CLASS #endif around it with a #define NEED_THIS_CLASS in it's .pch file.

The reason for this is that I use the framework for most of my apps, but if these classes are included, which are a part of the framework, it can be rejected in the app store if the classes are not used. So I outcomment the #define when I don't need it and use it if I do, this has worked without a problem.

The problem is now that I want to use it in another framework where I need to use these classes, it doesn't seem to be able to find the classes. It's as if the #define NEED_THIS_CLASS is not there.

I can fix it by removing the #ifdef #endif around the classes, so it doesn't seem to be a problem with some referencing. It can find it if the #ifdef isn't there, and I can use all the other classes in the framework just fine. But it's alot more convenient to only have to change it in one place instead of 6 places if I need/don't need these classes.

Anyone have experience with #ifdef #endif in frameworks inside frameworks who has a solution to my problem? Any help would be much appreciated :)

The framework has to be compiled with the option, as it's just a glorified shared library. Once you add the framework to the project, it is already done compiling and whatever your compile time settings and switches are, they won't affect the binary that has already been generated for the framework.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM