我正在从编程中学习 C++:Bjarne Stroustrup 的原则和实践。他们给出了一个示例程序:
// read and write a first name
#include "std_lib_facilities.h"
int main()
{
cout << "Please enter your first name (followed by 'enter'):\n";
string first_name; // first_name is a variable of type string
cin >> first_name; // read characters into first_name
cout << "Hello, " << first_name << "!\n";
}
当我在 Visual Studio 中键入相同的代码时,它会为头文件“std_lib_facilities.h”提供错误。我对这个头文件感到困惑。
还在用吗?我还能用什么来代替这个标题?
原文由 r0gue 发布,翻译遵循 CC BY-SA 4.0 许可协议
在《Programming: Principles and Practice Using C++》一书的附录(具体为C.3.2)中,您实际上可以找到作者对这个特定头文件-std_lib_facilities.h的解释,他为读者留下了一个链接下载( http://www.stroustrup.com/Programming/std_lib_facilities.h )。
由于学习者必须下载该文件并将其放置在您选择的目录中,因此我从这一点推断该文件不是人们实际使用的头文件,而仅用于教学用途。