{"id":619,"date":"2019-11-29T21:28:11","date_gmt":"2019-11-30T05:28:11","guid":{"rendered":"http:\/\/35.243.195.209\/?p=619"},"modified":"2019-12-02T21:31:17","modified_gmt":"2019-12-03T05:31:17","slug":"include-syntax","status":"publish","type":"post","link":"https:\/\/nanzhou.cc\/index.php\/2019\/11\/29\/include-syntax\/","title":{"rendered":"Include Syntax"},"content":{"rendered":"<h2>Summary<\/h2>\n<p>In this post, I will introduce the different between <code>#include &quot;file&quot;<\/code> and <code>#include &lt;file&gt;<\/code> in C++. <\/p>\n<h2>Conclusion<\/h2>\n<h3><code>#include &lt;file&gt;<\/code><\/h3>\n<p>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.<\/p>\n<h3><code>#include &quot;file&quot;<\/code><\/h3>\n<p>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 <code>&lt;file&gt;<\/code>. You can prepend directories to the list of quote directories with the -iquote option.<\/p>\n<h3>Options<\/h3>\n<pre><code class=\"language-bash\">-I dir\n-iquote dir<\/code><\/pre>\n<p>Add the directory dir to the list of directories to be searched for header files during preprocessing.<\/p>\n<p>Directories specified with -iquote apply only to the quote form of the directive, <code>#include &quot;file&quot;<\/code>. Directories specified with -I apply to lookup for both the #include &quot;file&quot; and <code>#include &lt;file&gt;<\/code> directives.<\/p>\n<p>You can specify any number or combination of these options on the command line to search for header files in several directories. The lookup order is as follows:<\/p>\n<ol>\n<li>For the quote form of the include directive, the directory of the current file is searched first.<\/li>\n<li>For the quote form of the include directive, the directories specified by -iquote options are searched in left-to-right order, as they appear on the command line.<\/li>\n<li>Directories specified with -I options are scanned in left-to-right order.<\/li>\n<li>Directories specified with -isystem options are scanned in left-to-right order.<\/li>\n<li>Standard system directories are scanned.<\/li>\n<li>Directories specified with -idirafter options are scanned in left-to-right order.<\/li>\n<\/ol>\n","protected":false},"excerpt":{"rendered":"<p>Summary In this post, I will introduce the different between #include &quot;file&quot; and #include &lt;file&gt; in C++. Conclusion #include &lt;file&gt; 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. #include &quot;file&quot;&#8230;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[6,5],"tags":[],"class_list":["post-619","post","type-post","status-publish","format-standard","hentry","category-c","category-proglang"],"_links":{"self":[{"href":"https:\/\/nanzhou.cc\/index.php\/wp-json\/wp\/v2\/posts\/619","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/nanzhou.cc\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/nanzhou.cc\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/nanzhou.cc\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/nanzhou.cc\/index.php\/wp-json\/wp\/v2\/comments?post=619"}],"version-history":[{"count":5,"href":"https:\/\/nanzhou.cc\/index.php\/wp-json\/wp\/v2\/posts\/619\/revisions"}],"predecessor-version":[{"id":625,"href":"https:\/\/nanzhou.cc\/index.php\/wp-json\/wp\/v2\/posts\/619\/revisions\/625"}],"wp:attachment":[{"href":"https:\/\/nanzhou.cc\/index.php\/wp-json\/wp\/v2\/media?parent=619"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/nanzhou.cc\/index.php\/wp-json\/wp\/v2\/categories?post=619"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/nanzhou.cc\/index.php\/wp-json\/wp\/v2\/tags?post=619"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}