![]() |
Understudy.net/orgOk you have made it this far.You obviously must be bored and have nothing better to do with your life. |
![]() |
[Previous entry: "Stuff"] [Main Index] [Next entry: "Couple more small articles for Chucktips"]
08/01/2004 Archived Entry: "Sam's C++ in 10 minutes is a bad book (second edition)"
Do not buy this book. It is a waste of money. First and foremost. It leaves out everything you need to know about compilers. No compiling, no programming.
Second , the books lessons don't work. If you are using FreeBSD and g++ for a compilier give up now.
Here is the second program from the book:
#include
using namespace std;
int main(int argc, char* argv[])
{
Without "using" statement, this would be std::cout
cout << "Hi there!" << end1; "end1" = next line
return 0;
}
Well when you run the g++ compiler from your command prompt , you get this:
main.cpp: In function `int main(int, char **)':
main.cpp:8: `end1' undeclared (first use this function)
main.cpp:8: (Each undeclared identifier is reported only once
main.cpp:8: for each function it appears in.)
Well that means it doesn't work. This is the second lesson in the book. It is so nice to know that the editors don't actually proof check their work.
Save your money.
Replies: 6 comments
It's endl (the letter L, lowercase). btw.
Posted by Someone @ 08/03/2004 04:54 AM EST
You are right. I will try that after work today. The book makes no clairification on that. So the symbol is "l" not "1". I wonder how anyone could get confused by that.:)
Please note that the css sheet may not render the apperance of the charecters properly.
Posted by Understudy @ 08/03/2004 08:36 AM EST
Changing the 1 to an l has definitly improved things as far as that issue goes. It would have been nice for a small note explaing the difference.
Posted by Understudy @ 08/04/2004 11:21 PM EST
I meant to point out some of the other fun items also. For example that there is no explanation on the setting of the PATH or using a ./ to run the programs. In the examples in the early lessons with main.cpp . You need to compile the program and the the result is called a.out (you won't find that in the book). Then in order to get the result you need to type ./a.out .That will cause the program to run. Basically what happens is if you haven't set a proper PATH in your shell rc file it won't run the program. Now this is how it is for FreeBSD. I am not sure how it is for Windows or other operating systems. And I realize that the book was designed not to be a complete guide to c++ but they could have in the first chapter given a bit more information on how the programs work and are accessed.
Posted by Understudy @ 08/15/2004 10:41 PM EST
The issues you complain about are all system-specific. On some flavors of linux, the pwd (present working directory) is in the path, so you don't need to run the program with a "./".
On most flavors of linux/*nix you do not need to set the PATH for basic compiling.
endl means "end line", and cout is "console out".
The book should explain that...if not, I highly recommend "Thinking in C++". It is available for free on the net.
Posted by Tutor @ 09/02/2004 11:57 AM EST
Thanks for the recommendation.
Posted by Understudy @ 09/02/2004 12:31 PM EST