473,287 Members | 1,399 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,287 software developers and data experts.

Difference between #include <xx> and #include "xx"?

MrPickle
100 100+
What's the difference between the two? They both appear to do the same thing but if they both just did the same thing then why have 2 things to do 1 job?
Aug 15 '08 #1
4 1789
If you use #include<xx> then it searches in the path for the file. However, if you use #include "xx" then it will start searching in the current directory, though I believe it will search the path after a while.

By the way. The path is where your system stores libraries and the associated header files.

Edward
Aug 15 '08 #2
MrPickle
100 100+
I see, so it's best to use #include <xx> for library's in your include folder & what not and #include "xx" for your own headers, etc?

Thanks.
Aug 15 '08 #3
Laharl
849 Expert 512MB
That is correct, yes.
Aug 15 '08 #4
JosAH
11,448 Expert 8TB
This is what the C99 Standars has to say about this:

[#2] 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.

[#3] 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.

[#4] A preprocessing directive of the form

# include pp-tokens new-line

(that does not match one of the two previous forms) is
permitted. The preprocessing tokens after include in the
directive are processed just as in normal text. (Each
identifier currently defined as a macro name is replaced by
its replacement list of preprocessing tokens.) The
directive resulting after all replacements shall match one
of the two previous forms.134) The method by which a
sequence of preprocessing tokens between a < and a >
preprocessing token pair or a pair of " characters is
combined into a single header name preprocessing token is
implementation-defined.
So basically you have to consult your manual for the actual implementation's
behaviour.

kind regards,

Jos
Aug 16 '08 #5

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: Christian Schmidbauer | last post by:
Hello! I prepare my XML document like this way: ------------------------------------------------------- PrintWriter writer; Document domDocument; Element domElement; // Root tag
13
by: Dan R Brown | last post by:
I have a large form that is generated dynamically in a jsp using xml / xslt. So, to break up this form into several "tabbed" sections, I break up the form using <div> tags. Each <div...
0
by: Gianni Mariani | last post by:
I remember seeing a neat template specialization trick posted here a few months ago that allowed the detection of a type containing a member. After a day searching through google archives I come up...
23
by: Loony | last post by:
I have got a code like this in HTML section in ASP file which includes javascript file! The script works under MS IE but doesn't with Firefox! Can anybody tell me what is wrong? <HTML>...
3
by: Raghuram | last post by:
Hi, What is the use of <Identity Impersonate="true" /> How can we implement this in an ASP.NET application When are we supposed to use this. please provide me the details with an Example....
37
by: Jan Wagner | last post by:
Hi, can't figure this one out, what's the CSS way to specify the language? In HTML it would be simply an lang="xx" attribute, or XHTML xml:lang="xx", but, how about in CSS? This would be...
6
by: Gaijinco | last post by:
I was trying to solve: acm.uva.es/p/v101/10191.html I did this code: #include <iostream> #include <fstream> #include <string> #include <vector> #include <algorithm> #include <cctype>
0
by: jaimebienlesfruits | last post by:
Is there a script I can include on the bottom of each page to indicate when the page was last updated? The PHP timstamp thing doesn't seem to work as it reflects the date of visit on the user's part....
5
by: Charles Packer | last post by:
In the code example below, why does the reference to gdk_pixbuf_new_from_file in main compile okay, but in subr2 gives the error "dereferencing pointer to incomplete type"? A search through this...
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 7 Feb 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:30 (7.30PM). In this month's session, the creator of the excellent VBE...
0
by: MeoLessi9 | last post by:
I have VirtualBox installed on Windows 11 and now I would like to install Kali on a virtual machine. However, on the official website, I see two options: "Installer images" and "Virtual machines"....
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: Aftab Ahmad | last post by:
Hello Experts! I have written a code in MS Access for a cmd called "WhatsApp Message" to open WhatsApp using that very code but the problem is that it gives a popup message everytime I clicked on...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.