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

linux - Using a Cron Job to check if my mod_wsgi / apache server is running and restart -

actionscript 3 - TweenLite does not work with object -

jQuery Ajax Render Fragments OR Whole Page -