This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

include header files



hy guys,

I have a question what is the difference by including a header file with <...> and "..".

I think when I use the ".." the file have to be in the project folder but I don't where I have to move the files when I use the <...>.

  • Why do you need to use the include with <...>?

    Usually the #include directive with <...> is used to include the header files from the compiler folder directory, on the other hand, the #include directive with "..." is used for user implementation files, often located in the folder project or other path informed by user in the build configurations.

    Resuming...

    • Include with angle brackets: Used for standard files. Compiler searches for standard files in the path list.
    • Include with double quotes: Used for user defined files. Compiler searches for local files in the current directory.

    If I understand your question, you can find further explanation in the following link:  http://stackoverflow.com/questions/3162030/difference-between-angle-bracket-and-double-quotes-while-including-heade

    The GCC user manual tell us:

    #include <file>This variant is used for system header files. It searches for a file named file in a standard list of system directories. You can prepend directories to this list with the -I option (see Invocation). 

    #include "file"This variant is used for header files of your own program. It searches for a file named file first in the directory containing the current file, then in the quote directories and then the same directories used for<file>. You can prepend directories to the list of quote directories with the -iquote option.

    Regards,

  • If you use GCC, the GCC user manual tell us that

    #include <file>
    This variant is used for system header files. It searches for a file named file in a standard list of system directories. You can prepend directories to this list with the -I option (see Invocation).

    #include "file"
    This variant is used for header files of your own program. It searches for a file named file first in the directory containing the current file, then in the quote directories and then the same directories used for <file>. You can prepend directories to the list of quote directories with the -iquote option.

    Why do you want to use your #include directive wit angle brackets?

**Attention** This is a public forum