OpenStax CNX

You are here: Home » Content » Conditional Compilation

About: Conditional Compilation

Module by: Kenneth Leroy Busbee. E-mail the author

View the content: Conditional Compilation


Name: Conditional Compilation
ID: m22204
Language: English (en)
Summary: An introduction and example of conditional compilation as used within the C++ programming language.
Subject: Science and Technology
License: Creative Commons Attribution License CC-BY 3.0

Authors: Kenneth Leroy Busbee (
Copyright Holders: Kenneth Leroy Busbee (
Maintainers: Kenneth Leroy Busbee (

Latest version: 1.5 (history)
First publication date: Apr 20, 2009 8:43 pm -0500
Last revision to module: May 11, 2010 11:42 am -0500


PDF: m22204_1.5.pdf PDF file, for viewing content offline and printing. Learn more.
XML: m22204_1.5.cnxml XML that defines the structure and contents of the module, minus any included media files. Can be reimported in the editing interface. Learn more.

Version History

Version: 1.5 May 11, 2010 11:42 am -0500 by Kenneth Leroy Busbee
Updated/improved the Demo_Conditional_Compilation.cpp source code file.

Version: 1.4 Jan 15, 2010 3:18 pm -0600 by Kenneth Leroy Busbee
Added Google Analytics.

Version: 1.3 May 6, 2009 3:12 pm -0500 by Kenneth Leroy Busbee
Minor modifications and update the demo source code file. 

Version: 1.2 Apr 21, 2009 12:32 pm -0500 by Kenneth Leroy Busbee
Fixed preformat so PDF printing was ok. 

Version: 1.1 Apr 20, 2009 8:58 pm -0500 by Kenneth Leroy Busbee
Initial module.

How to Reuse and Attribute This Content

If you derive a copy of this content using a OpenStax-CNX account and publish your version, proper attribution of the original work will be automatically done for you.

If you reuse this work elsewhere, in order to comply with the attribution requirements of the license (CC-BY 3.0), you must include

  • the authors' names: Kenneth Busbee
  • the title of the work: Conditional Compilation
  • the OpenStax-CNX URL where the work can be found:

See the citation section below for examples you can copy.

How to Cite and Attribute This Content

The following citation styles comply with the attribution requirements for the license (CC-BY 3.0) of this work:

American Chemical Society (ACS) Style Guide:

Busbee, K. Conditional Compilation, OpenStax-CNX Web site., May 11, 2010.

American Medical Assocation (AMA) Manual of Style:

Busbee K. Conditional Compilation [OpenStax-CNX Web site]. May 11, 2010. Available at:

American Psychological Assocation (APA) Publication Manual:

Busbee, K. (2010, May 11). Conditional Compilation. Retrieved from the OpenStax-CNX Web site:

Chicago Manual of Style (Bibliography):

Busbee, Kenneth. "Conditional Compilation." OpenStax-CNX. May 11, 2010.

Chicago Manual of Style (Note):

Kenneth Busbee, "Conditional Compilation," OpenStax-CNX, May 11, 2010,

Chicago Manual of Style (Reference, in Author-Date style):

Busbee, K. 2010. Conditional Compilation. OpenStax-CNX, May 11, 2010.

Modern Languages Association (MLA) Style Manual:

Busbee, Kenneth. Conditional Compilation. OpenStax-CNX. 11 May 2010 <>.