【发布时间】:2016-01-14 20:53:31
【问题描述】:
我最近购买了 Bjarne Stroustrup 的“编程:使用 C++ 的原则和实践”一书,并一直在关注它。我目前被困在一个早期项目中,我需要输出一些文本字符串。在 Windows 10 Lenovo Yoga 2 Pro 笔记本电脑上使用 Visual Studio Community 2015 更新 1,我尝试编译该项目,但遇到了详细的错误:
“无法打开预编译的头文件:Debug\Finding the Upstairs Bathroom.pch':没有这样的文件或目录”。该项目的名称恰如其分地命名为“寻找楼上浴室.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;
}
如果有人能够弄清楚如何解决我的错误,我将不胜感激。
【问题讨论】:
-
显示所有包含的内容
-
我会关闭预编译的头文件,或者学习如何使用它们。 msdn.microsoft.com/en-us/library/b4w02hte.aspx
-
我的包含是:#include
#include #include #include #include #include #include - #include #include #include
-
另外,您似乎正在使用 MFC(有一段时间没有使用 VS,但我很确定是这种情况)。如果您想学习 C++,最好避免使用此类框架,而使用标准库。
标签: c++ compiler-errors visual-studio-2015