我最近购买了Bjarne Stroustrup的《Programming: Principles and Practice Using C++》一书,并一直在跟进学习。目前我卡在了一个早期项目上,需要输出一些文本字符串。我使用Windows 10 Lenovo Yoga 2 Pro笔记本电脑上的Visual Studio Community 2015更新1进行编译,但遇到了以下错误:“无法打开预编译头文件:Debug\Finding the Upstairs Bathroom.pch':没有那个文件或目录”。该项目的名称恰当地命名为“Finding the Upstairs Bathroom.cpp”。以下是代码:
我希望有人能够找出如何修复我的错误。
// I have the headers "stdafx.h" as well as this specific header lib
// Bjarne Stroustrup created and which I had linked
// called "../../std_lib_facilities.h", which contains the standard C++ lib functions.
(#) define _SILENCE_STDEXT_HASH_DEPRECATION_WARNINGS 1
int main()`// Main function`
{
cout << "Take the key out of your right pants pocket\n"; // Outputs string of text
cout << "Unlock the front door of the house\n";
cout << "Open the front door and step inside\n";
cout << "Lock the front door using the key\n";
cout << "Move up the stairs, taking them two at a time\n";
cout << "Walk to the second door on the left and face it directly\n";
cout << "Using the door handle, turn it and push the door forward\n";
cout << "Enter the bathroom while leaving the door open behind you\n";
keep_window_open();
return 0;
}
我希望有人能够找出如何修复我的错误。