#include <> vs #include " "

This is a discussion on #include <> vs #include " " within the C Programming forums, part of the General Programming Boards category; when working with multi-modules, im just wondering whats the difference in using the <> brackets vs the double quotations.....

  1. #1
    Registered User
    Join Date
    Jun 2007
    Posts
    36

    #include <> vs #include " "

    when working with multi-modules, im just wondering whats the difference in using the <> brackets vs the double quotations..

  2. #2
    Just Lurking Dave_Sinkula's Avatar
    Join Date
    Oct 2002
    Posts
    5,006
    Common practice is to use <> for system headers and "" for your own.
    7. It is easier to write an incorrect program than understand a correct one.
    40. There are two ways to write error-free programs; only the third one works.*

  3. #3
    Registered User
    Join Date
    Jun 2007
    Posts
    36
    Quote Originally Posted by Dave_Sinkula View Post
    Common practice is to use <> for system headers and "" for your own.

    so for example, if im using a C library function, like stdio, then i would use
    #include <stdio.h> ...

    and if im using my own function,
    #include "myown.h" ?

  4. #4
    Just Lurking Dave_Sinkula's Avatar
    Join Date
    Oct 2002
    Posts
    5,006
    Quote Originally Posted by sh4k3 View Post
    so for example, if im using a C library function, like stdio, then i would use
    #include <stdio.h> ...

    and if im using my own function,
    #include "myown.h" ?
    Pretty much.
    7. It is easier to write an incorrect program than understand a correct one.
    40. There are two ways to write error-free programs; only the third one works.*

  5. #5
    and the hat of wrongness Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    32,484
    I usually go with using <> for the standard header files, and also 3rd party library header files which have been located using say -I/path command line options.

    For local header files to the project, use ""
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.
    I support http://www.ukip.org/ as the first necessary step to a free Europe.

  6. #6
    Deathray Engineer MacGyver's Avatar
    Join Date
    Mar 2007
    Posts
    3,211
    I believe <> is generally searched by the compiler in the standard header files directory while "" is generally searched by the compiler in the current directory + whatever is specified on the command line (or via the IDE to the compiler via parameters).

    Either way, standard header files should be included with <>.

  7. #7
    Registered User
    Join Date
    Jun 2007
    Posts
    36
    great
    thx

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 48
    Last Post: 09-26-2008, 03:45 AM
  2. 2d game
    By JordanCason in forum Game Programming
    Replies: 5
    Last Post: 12-08-2007, 09:08 PM
  3. MFC include BS
    By VirtualAce in forum Windows Programming
    Replies: 4
    Last Post: 10-31-2005, 11:44 AM
  4. help with finding lowest number entered
    By volk in forum C++ Programming
    Replies: 12
    Last Post: 03-22-2003, 12:21 PM
  5. MFC Assertion Failure
    By maxthecat in forum Windows Programming
    Replies: 5
    Last Post: 08-01-2002, 09:58 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21