【发布时间】:2015-06-10 09:14:29
【问题描述】:
复制:
When can you omit the file extension in an #include directive?
找到后感觉自己聪明了一点:
What is the difference between #include <filename> and #include "filename"?
但在我的代码中,我使用 #include <string>。string 不是有效的文件名,并且尖括号没有放在 "" 中。
这是第三种方式吗包括其他文件或我如何理解这一点?
换句话说,<string> 是什么?
【问题讨论】:
-
“字符串不是有效的文件名”。谁说的?
-
@n.m.有效的文件名不是头文件还是 cpp 文件? (.h 或 .cpp)
-
@NoelWidmer 查看系统(编译器)包含文件夹中的文件。
-
“cpp”并不是你想的那个意思,拜托,如果你想说“C++”,那就输入“C++”,而不是“cpp”,这样可以省去大家的烦恼。回到你的问题,头文件名不必以
.h结尾。