"Beginning C++ Through Game Programming"

Oct 9, 2013 at 10:47pm
I am very new to c++, and I just started reading a book called (you guessed it) "Beginning C++ Through Game Programming." I read several positive reviews of the book before I bought it, but the very first program in the book generated errors. I thought maybe I had typed it in wrong, so I went to their website and downloaded the source code, which is here:

http://www.delmarlearning.com/companions/content/1435457420/sourcecode/index.asp?isbn=1435457420

But I *still* got the same errors, which are
error C2039: 'end1' : is not a member of 'std'
error C2065: 'end1' : undeclared identifier

Am I doing something wrong? I can't believe that a well reviewed book would have misprints in the printed text and the website! Here's the program:


1
2
3
4
5
6
7
8
9
10
// Game Over
// A first C++ program

#include <iostream>

int main()
{
	std::cout << "Game Over!" << std::endl;
	return 0;
}


P.S. I'm using MS Visual C++ Express Edition
Last edited on Oct 9, 2013 at 10:52pm
Oct 9, 2013 at 10:55pm
There is nothing wrong with your code therefore it must be your ide or compiler. get code::blocks from its website and download the one called: codeblocks-12.11mingw-setup_user.exe

Website: www.codeblocks.org/
Last edited on Oct 9, 2013 at 10:57pm
Oct 9, 2013 at 10:59pm
it's endl (l as in a lowercase L.. for "line")
not end1 (the number one)

@Cronnoc: don't be so quick to blame the compiler. It's hardly ever the compiler.
Last edited on Oct 9, 2013 at 11:00pm
Oct 9, 2013 at 11:00pm
This might sound silly, but are you sure you're using l (lowercase L) and not 1 the number at the end of << endl; ?
Oct 9, 2013 at 11:05pm
closed account (jwkNwA7f)
There is nothing wrong with the code. Also, good choice for ur book
Oct 9, 2013 at 11:21pm
Just to reiterate... there is something wrong with the code.

He mistyped endl (end line) as end1 (end one)
Oct 9, 2013 at 11:29pm
endl: endl
end1: end1

if you look he did endl
Oct 9, 2013 at 11:41pm
Thanks for your replies everyone. Your were correct, Cronnoc, that was the problem. But I just wanted to clarify that the code that I pasted into my query was not typed in by me -- that was the code that I downloaded from the book's website. Which means there was, in fact, a typo in the book. Kinda doesn't bode well for the book. But I'll keep at it anyway, because I do like the way this book is written.

Thanks again everyone.
Oct 10, 2013 at 12:21am
Sorry -- I should have said "You were correct, Disch." Must give credit where credit is due!
Topic archived. No new replies allowed.