Header causing compile errors.

I'm working from the Bjarne Stroustrup Programming: Principles and Practice using C++ book. I've recently ran into a point in the book in which I must use the header file so I dug it up and saved it in the directory in which my .cpp files are held. When I try to run the program I get multiple compile errors which come from the std_lib_facilities.h file.

Here is a image of some of the compile errors http://prntscr.com/2inv3c

Here is the code I'm using. I believe it is just example but regardless, I get multiple errors when including the header.

1
2
3
4
5
6
7
 int framed_area(int x, int y) 
{
const int frame_width = 2;
if (x-frame_width<=O || y-frame_width<=O)
       error( "non-positive area() argument called by framed_area()");
return area(x-frame_width,y-frame_width);
}


Last edited on
The code in the book obviously depends on deprecated version of standard library. You must fix your std_lib_facilities.h etc.
closed account (iAk3T05o)
That book really confused me so i switched to another.
Post the full code so that we'll know what #include <> is for what.
Ignore the 'deprecated or antiquated header' warning.

The 'previous definition' errors come from including the header multiple times without an include guard.

The rest of the errors are in your code: O instead of 0 etc.

The header: http://coliru.stacked-crooked.com/a/158fa9ebed69967c

Program using the header: http://coliru.stacked-crooked.com/a/b4868e4539486bd5
Last edited on
> Here is a image of some of the compile errors
g++ foo.cpp 2> error.log
http://www.microsoft.com/resources/documentation/windows/xp/all/proddocs/en-us/redirection.mspx?mfr=true
Last edited on
Topic archived. No new replies allowed.