Include Statements

  • Use double quotes (“”) to include header files that live in the same directory as your source code.

  • Use angle brackets (<>) to include header files from outside a file’s directory.

  • Public headers for a library must be placed in the library’s source directory, not in a subdirectory.

  • Do not use absolute paths in #include directives. Any explicit path in front of the filename should be relative to the top of the relevant package. (See examples below.)

  • Order includes as shown below. Within each subsection, list files in alphabetical order:

    // Include body's corresponding header first
    #include "PathIntegrator.h"
    // Include headers local to current library next
    #include "BsdfSampler.h"
    #include "LightSetSampler.h"
    // Include headers from internal libraries next
    #include <moonray/rendering/mcrt_common/Ray.h>
    #include <scene_rdl2/common/math/Constants.h>
    // Include headers from external libraries next
    #include <OpenImageIO/version.h>
    // Include C++ and system headers last
    #include <limits> 
    #include <memory>