何时使用#include<>和#include“ " [英] When to use #include <> and #include " "
问题描述
我的问题是,如果我创建了自己的库,它位于自己的
安装目录中,要引用它的头文件,最好使用
#include" MyLibrary.h"
或
#include< MyLibrary.h>
假设其他组将使用此库。我认为答案
应该使用<>符号,但我会感兴趣的原因。
欢呼
Tuckers
<>保留给标准库和一些系统库。所以你
可能会使用"
ben
" Tuckers" <毫安** @ work.com>在留言新闻中写道:d6 ********* @ rdel.co.uk ...我的问题是,如果我创建了自己的图书馆,那就是它自己的作品/>安装目录,引用它的头文件是否更好使用
#include" MyLibrary.h"
# include< MyLibrary.h>
假设其他组将使用此库。我认为答案应该是使用<>符号,但我会感兴趣为什么。
欢呼
Tuckers
ben写道:<>保留给标准库和一些系统库。所以你可以使用"
<>确保如果你给它一个标准标题的名称,肯定会得到
。否则#include的行为是实现
定义为引用字符串的解释是什么(和
你使用的是哪一组分隔符)。
ben写道:<>保留给标准库和一些系统库。所以
你可以使用"
废话。查找标题的路径是不同的,
没有其他内容(详情请参阅一本好的C ++书籍)。
RC
My question is, if I have created my own library which lives in its own
install directory, to refer to its header file is it better to use
#include "MyLibrary.h"
or
#include <MyLibrary.h>
Assume that this library will be used by other groups. I think the answer
should be use the "<>" notation but I would be interested why.
cheers
Tuckers
<> is reserved for the standard library and some system libraries. so you
may use ""
ben
"Tuckers" <ma**@work.com> wrote in message news:d6*********@rdel.co.uk...My question is, if I have created my own library which lives in its own
install directory, to refer to its header file is it better to use
#include "MyLibrary.h"
or
#include <MyLibrary.h>
Assume that this library will be used by other groups. I think the answer
should be use the "<>" notation but I would be interested why.
cheers
Tuckers
ben wrote:<> is reserved for the standard library and some system libraries. so you
may use ""
<> assures that if you give it the name of a standard header, you get
that for sure. Otherwise the behavior of #include is implementation
defined as to what the interpretation of the quoted string is (and
which set of delimeters you used).
ben wrote:<> is reserved for the standard library and some system libraries. so you may use ""
Nonsense. The path in which the header is looked up is different,
nothing else (see a good C++ book for details).
R.C.
这篇关于何时使用#include<>和#include“ "的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!