C++ compiler inherently defines a macro named __cplusplus. Sometimes it is necessary to prevent the user from compiling the C code using C++ compiler. We can do that by giving an error message during compilation using the following statement:

#ifndef __cplusplus
#error "Please compile with C compiler only"

You have viewed 1 page out of 248. Your C learning is 0.00% complete. Login to check your learning progress.

 Vote 0

Similar topics related to this section

macro vs constant, enum vs macro, macro vs typedef, debug builds, debug macros, compiler macro for C++, FILE, LINE, DATE, TIME, compiler marcos, token pasting, characterizing,

# C Programming Language (Prentice Hall Software)
# Let Us C Paperback - 2006 by Yashavant Kanetkar
# Understanding and Using C Pointers Core techniques for memory management
# Data Structures Using C and C++ Paperback - 1998
# Data Structures In C Paperback - August 11, 2008 by Noel Kalicharan