macros - How to trigger the __cplusplus (C++) #ifdef? -


#ifdef __cplusplus // c++ code #else // c code #endif 

the structure this. question is, how trigger #ifdef on?

i mean, in program? code write can turn #ifdef on?

for example, in case.

#define __cplusplus 

will turn on?

"#define __cplusplus"

will let on?

yes, "let on".

__cplusplus should automatically defined c++ compiler. c++ uses different name mangling , macro used make c headers compatible c++:

#ifdef __cplusplus extern "c" { #endif  ...  #ifdef __cplusplus } #endif 

Comments

Popular posts from this blog

javascript - Iterate over array and calculate average values of array-parts -

iphone - Using nested NSDictionary with Picker -

objective c - Newbie question -multiple parameters -