This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

difference between and " " for # include

What is the difference between these two sentence:( <> and " ")?

#include <rtl.h>

#include "rtl.h"

Parents Reply Children
  • The rule-book states that any "< >" includes are a big red-flag that cautions a potential non-portable source-code reference.

    In general all source should be in the project's directory. The few exceptions are the ANSI standard inclusions like <stdio.h>.

    One should not rely upon the IDE's environment variables to build the software (e.g. exactly where the <stdio.h> is located).

    If you have multiple cross-compilers or even PC compilers or other software that has include path information you better make sure your IDE is referencing the right subdirectory.

    The IDE package usually controls this fairly well, but "the rule-book" tries to force the code-monkey into having a single project directory (with potential subdirectories) which contains all of the code needed for a build, and should not rely upon the tool-chain's implied include paths.

    Yes, I know that a build itself implies the IDE's inclusion path, but the fewer "< >" inclusions, the better the encapsulation of the source code is.

    This becomes especially important when a 'new' library is added to your IDE's tool-chain. You just cannot assume that a new machine with Keil's IDE installed will also contain the 'new' library information; and thus not able to build an executable based upon the source code and the cross-compiler.

    --Cpt. Vince Foster
    2nd Cannon Place
    Fort Marcy Park, VA

  • Yes, it is definitely better to have 3rd-party libraries hard-linked to projects, instead of having them installed system-wide and after an update of the library find out that 3 out of 12 projects suddenly doesn't build.

    I normally install extra libraries in directories that specifies the exact library version and have the different project specify exactly what library version to use. That allows multiple versions to be available at the same time and existing projects can be rebuilt without any changes.

    Another danger when having extra header files in the <> namespace is the potential namespace collision. It isn't so fun when the order of the path controls which header files that gets used.