سؤال

My project structure

MainProject (ARC)
    SubProject(Non-ARC)
        Boost library(i.e. Popular C++ library here is a link http://www.boost.org/) 

Problem :
One of header file(intrusive_ptr.h) of Boost library has a inline function with "retain" statement(That file is edited by someone and it is working fine in "SubProject(Non-ARC)"). That header file is public, many files of subporjects are imported in "MainProject" and those file has a reference of this header file. So, indirectly that file comes in MainProject which is an ARC based. That's why compiler refuse to compile.

What I know or tried:
I know how to set the non ARC flag but that we can set only for .m file(compilable file only) not on .h file. if somebody could help me or suggest me any out of box solution.

For the persons who are interested in seeing the "intrusive_ptr.h" can find here intrusive_ptr.h. This file is a part of boost library so, suggestion should consider this library as well.

Any help or directions will be appreciated.

هل كانت مفيدة؟

المحلول

You can use the preprocessor to alter your header file using the technique from this answer

#if __has_feature(objc_arc)
//ARC-specific things
#else
//Non-ARC specific things
#endif

نصائح أخرى

If you need Boost facility in some classes you can hide that using Objective-C++. Helper links: http://philjordan.eu/article/strategies-for-using-c++-in-objective-c-projects

http://support.apple.com/kb/TA45902?viewlocale=en_US

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top