Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > C++ > include header

Reply
Thread Tools

include header

 
 
Christopher
Guest
Posts: n/a
 
      03-20-2008
On Mar 19, 9:03 pm, June Lee <iiu...@yahoo.com> wrote:
> when include headers in C++ what's different when using
>
> < > or " " like the following?
>
> #include "ne_session.h"
> #include <ne_uri.h>


First hit on Google when searching for: include "" vs include <>
http://www.thescripts.com/forum/thread138207.html

Tryed Google advanced search to limit to this NG, but couldnt get it
to work

At any rate it has been asked before, Google is your friend.
 
Reply With Quote
 
 
 
 
Alexander Dong Back Kim
Guest
Posts: n/a
 
      03-20-2008
On Mar 20, 1:03 pm, June Lee <iiu...@yahoo.com> wrote:
> when include headers in C++ what's different when using
>
> < > or " " like the following?
>
> #include "ne_session.h"
> #include <ne_uri.h>


#include "..." means the header file is in the same directory,
where #include <...> means the header file is in the directory that
the compiler uses.

My explanation is not covering everything about the differences
between two. As Christopher recommended you, do some googling, you
will find more than millions of tutorials =)

cheers,
Alex
 
Reply With Quote
 
 
 
 
June Lee
Guest
Posts: n/a
 
      03-20-2008
when include headers in C++ what's different when using

< > or " " like the following?


#include "ne_session.h"
#include <ne_uri.h>
 
Reply With Quote
 
Kai-Uwe Bux
Guest
Posts: n/a
 
      03-20-2008
June Lee wrote:

> when include headers in C++ what's different when using
>
> < > or " " like the following?
>
>
> #include "ne_session.h"
> #include <ne_uri.h>


What these do is mostly up to the implementation. You have to check the
documentation of your compiler. Pay particular attention to settings and
switches.


From the standard [16.2/2-3]:

A preprocessing directive of the form

# include <h-char-sequence> new-line

searches a sequence of implementation-defined places for a header identified
uniquely by the specified sequence between the < and > delimiters, and
causes the replacement of that directive by the entire contents of the
header. How the places are specified or the header identified is
implementation-defined.

A preprocessing directive of the form

# include "q-char-sequence" new-line

causes the replacement of that directive by the entire contents of the
source file identified by the specified sequence between the " delimiters.
The named source file is searched for in an implementation-defined
manner. If this search is not supported, or if the search fails, the
directive is reprocessed as if it read

# include <h-char-sequence> new-line

with the identical contained sequence (including > characters, if any) from
the original directive.



Best

Kai-Uwe Bux
 
Reply With Quote
 
James Kanze
Guest
Posts: n/a
 
      03-20-2008
On Mar 20, 3:07 am, Kai-Uwe Bux <jkherci...@gmx.net> wrote:
> June Lee wrote:
> > when include headers in C++ what's different when using


> > < > or " " like the following?


> > #include "ne_session.h"
> > #include <ne_uri.h>


> What these do is mostly up to the implementation. You have to
> check the documentation of your compiler. Pay particular
> attention to settings and switches.


In practice, however, the first will first look in the directory
where the including file is located, then behave more or less
like the second. There may be options to override this, but if
you specify include directories using the more or less standard
-I option (or /I under Windows), then the first looks first in
the directory where the including file is located, then in the
directories specified by the -I options (in the order they were
given), then in the "standard" locatsions; the second just skips
the lookup in the directory where the including file is located.

Of course, there's no guarantee about this from the standard,
but the above does hold for pretty much all compilers on the
usual platforms (Windows and mainstream Unix). I think some of
the compilers have additional options, which can be used to
change it, however.

In good coding practice, of course, the first is used for your
headers, the second for system headers (with a more or less
application dependent notion of what is "system"---I would
generally consider things like the data base, or Boost, part of
the "system").

--
James Kanze (GABI Software) email:
Conseils en informatique orient�e objet/
Beratung in objektorientierter Datenverarbeitung
9 place S�mard, 78210 St.-Cyr-l'�cole, France, +33 (0)1 30 23 00 34
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Header files with "header.h" or <header.h> ?? mlt C++ 2 01-31-2009 02:54 PM
/* #include <someyhing.h> */ => include it or do not include it?That is the question .... Andreas Bogenberger C Programming 3 02-22-2008 10:53 AM
#include headers that include this header Aguilar, James C++ 2 07-16-2004 05:56 PM
Re: the use of #include <a_file.h> v/s #include"a_file.cpp" Rolf Magnus C++ 2 11-28-2003 12:26 PM
#include "bar" negates #include <string> ; how to fix? Danny Anderson C++ 5 08-15-2003 06:38 PM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57