I'm self-studying Bjarne Stroustrup's book "Programming: Principles and Practice Using C++" and I'm stuck on the first drill. He provides code for your to enter in. The code is below.
I downloaded the std_lib_facilities header file from his site and put it two directories up thus using ../../ in the header. I'm not sure why it's not compiling.
1 2 3 4 5 6 7 8
#include "../../std_lib_facilities.h"
int main() // C++ programs start by executing the function main
{
cout << "Hello, World!\n"; // output "Hello, World!"
keep_window_open(); //wait for a character to be entered
return 0;
}
1>c:...fatal error C1083: Cannot open include file: '../std_lib_facilities.h': No such file or directory
GO through the above link it might be useful.I think you must have save to a wrong folder.
If you really want to print "Hello World" just use iostream header rather than getting complicated.
1 2 3 4 5 6 7 8 9 10
#include <iostream>
int main() // C++ programs start by executing the function main
{
std::cout << "Hello, World!\n"; // output "Hello, World!"
//wait for a character to be entered
return 0;
}
I actually did have ../../ twice but I typed it in the post wrong. I've tried the header file at various levels. It is a c++ file. I also tried it at various levels as a text file. At this point, I'm assuming the issue has something to do with the file type.
Follow the instructions in the book for a temporary fix (for the first several programs):
How do you find std_lib_facilities.h? If you are in a course, ask your instructor. If not, download it from our support site www.stroustrup.com/Programming. But what if you don’t have an instructor and no access to the web? In that case (only), replace the #include directive #include "std_lib_facilities.h" with