I have recently purchased the text "Programming: Principles and Practice Using C++" by Bjarne Stroustrup and have been following it through. I am currently stuck on an early project, where I need to output some strings of text. Using Visual Studio Community 2015 update 1, on a Windows 10 Lenovo Yoga 2 Pro laptop, I have attempted to compile the project but have ran into an error detailed:
"Cannot open precompiled header file: Debug\Finding the Upstairs Bathroom.pch': No such file or directory". The name of the project is aptly named "Finding the Upstairs Bathroom.cpp". Here is the code:
// 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;
}
I would be grateful if someone is able to figure out how to fix my error.
There are 2 options to solve this:
Rebuild the full project. This should (re)create the precompiled header (or select Build/Clean Solution
first).
Turn off precompiled headers. Project settings / C/C++ / Precompiled headers / Not Using Precompiled Headers
.
Appart from the options presented by Danny_ds, you can:
Create precompiled headers: Project settings / C/C++ / Precompiled Headers
Precompiled Headers: Create (/Yc)
Disable precompiled headers. Project settings / C/C++ / Precompiled Headers
Precompiled Headers: Not Using Precompiled Headers
I had the problem when I first had to create the precompiled header.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With