Reputation: 5220
In my Prefix.pch
file I am using __OBJC__
preprocessor define for compilation of Objective C headers. What is the equivalent for compilation of C++ headers?
#ifdef __OBJC__
#import <Foundation/Foundation.h>
#import <UIKit/UIKit.h>
#endif
Upvotes: 0
Views: 232
Reputation: 12088
There is a standard preprocessor constant, __cplusplus
. Its value is expanded to version number of C++ standard being used:
__cplusplus
denotes the version of C++ standard that is being used, expands to value 199711L (until C++11), 201103L (C++11), 201402L (C++14), or 201703L (C++17)
Source: cppreference
So, you can write, for example:
#ifdef __cplusplus
#if __cplusplus >= 201103L
// include new stuff
#else
// use legacy features
#endif
#endif
Upvotes: 2