Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game. |
| Notices |
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
Are you new to LinuxQuestions.org? Visit the following links:
Site Howto |
Site FAQ |
Sitemap |
Register Now
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
 |
GNU/Linux Basic Guide
This 255-page guide will provide you with the keys to understand the philosophy of free software, teach you how to use and handle it, and give you the tools required to move easily in the world of GNU/Linux. Many users and administrators will be taking their first steps with this GNU/Linux Basic guide and it will show you how to approach and solve the problems you encounter.
Click Here to receive this Complete Guide absolutely free. |
|
 |
08-06-2005, 12:22 PM
|
#1
|
|
Member
Registered: Jul 2004
Location: Rochester, NY
Distribution: Fedora9::FreeBSD7.1
Posts: 296
Rep:
|
New to C++ help with simple script
As the label says c++ is my first language other then php. im reading around through a book and to test a compiler i have a test scripts
#include<iostream>
int main()
{
std::count << "hello world\n";
return (0);
}
howerver when i run it with
CC -g otesting hello.cpp
i get the following error
Quote:
|
hello.cpp: in function 'int main()':
|
Quote:
|
hello.cpp:5 error: invalid operands of types '<unknown type>' and 'const char [13]' to binary 'operator<<'
|
Is this book maybe to old or is there something i need to configure?
thanks
|
|
|
|
08-06-2005, 12:28 PM
|
#2
|
|
LQ Addict
Registered: Jul 2003
Location: London, UK
Distribution: Slackware
Posts: 7,466
Rep: 
|
It should be std::cout, not count. Edit: I'm not sure if you should be using cc to compile C++, I thought that was just a C compiler. Try g++.
Last edited by Nylex; 08-06-2005 at 12:29 PM.
|
|
|
|
08-06-2005, 12:53 PM
|
#3
|
|
Member
Registered: Jul 2004
Location: Rochester, NY
Distribution: Fedora9::FreeBSD7.1
Posts: 296
Original Poster
Rep:
|
Thanks, yea reading through the book they let you know of all compilers but gives little to none on which one you should use. And that cout was my own doing ><
thanks =D
//edit
since i got you here mind if i add a few more questions?
Thought the book most work is done with some IDE is it ok that i just write my scripts in xemacs or is there a downside to this? if there is what type of ide should i use?
thanks
Last edited by Fredstar; 08-06-2005 at 01:03 PM.
|
|
|
|
08-06-2005, 01:00 PM
|
#4
|
|
LQ Addict
Registered: Jul 2003
Location: London, UK
Distribution: Slackware
Posts: 7,466
Rep: 
|
To compile hello.cpp into an executable called hello, you use "g++ hello.cpp -o hello". Which book is it that you have?
|
|
|
|
08-06-2005, 01:06 PM
|
#5
|
|
Member
Registered: Jul 2004
Location: Rochester, NY
Distribution: Fedora9::FreeBSD7.1
Posts: 296
Original Poster
Rep:
|
Practical C++ programming
|
|
|
|
08-07-2005, 04:31 AM
|
#6
|
|
Member
Registered: May 2005
Posts: 378
Rep:
|
Quote:
Originally posted by Fredstar
Thought the book most work is done with some IDE is it ok that i just write my scripts in xemacs or is there a downside to this? if there is what type of ide should i use?
|
Use whatever editor/IDE you feel comfortable with. I'm happy with vi (the World's Best Editor  ) and the Korn shell history facility to develop my programs.
|
|
|
|
08-07-2005, 04:45 AM
|
#7
|
|
LQ Addict
Registered: Jul 2003
Location: London, UK
Distribution: Slackware
Posts: 7,466
Rep: 
|
Hmm, I've not got "Practical C++ Programming" myself, but it seems to get mixed reviews (at least on Amazon).
|
|
|
|
08-07-2005, 12:24 PM
|
#8
|
|
Member
Registered: Jan 2005
Location: Chandler, AZ USA
Distribution: Mandrake/Mandriva 10.2
Posts: 186
Rep:
|
Practical C++ Is a great book, I Love all O'reilly books. But it seems a lot of programming books get mixed reviews depending on how much knowledge you have on the subject before reading the book. I had a good grasp of C++ and have been programming in C and similar languages e.g. Java for a few years before reading it, so mileage may vary.
I do like how it gives you little tasks to try, they are similar to the labs I had in my CSE classes a few years ago. They even touch on making your own data structures, essential to any good programmers tool box.
I find myself still picking up the book for reference and to reread certain areas.
By the way, I picked up mine for only about $5 with shipping on half.com. Good stuff.
Last edited by elyk1212; 08-07-2005 at 12:25 PM.
|
|
|
|
08-08-2005, 10:59 AM
|
#9
|
|
Member
Registered: Jan 2004
Location: arse-end of the world
Distribution: Zenwalk 2.8
Posts: 73
Rep:
|
Read up on GCC. There's a couple of nice chapters in "Running Linux" by Welsh et. al., and there is of course the manual.
By the way, you can get rid of the parentheses () around 0.
For beginner C++ books, if you have a little bit of programming knowledge (even if it's in unrelated languages), the following books are greatly recommended:
"Accelerated C++: Practical Programming By Example" by Andrew Koenig and Barbara E. Moo
"C++ Primer (4th edition)" by Stanley B. Lippman et. al.
If you have C knowledge, then you might try:
"Thinking in C++, Volume 1: Introduction to Standard C++ (2nd Edition)" by Bruce Eckel
And, of course, at some stage you must get the bible:
"The C++ Programming Language (3rd Edition)" by Bjarne Stroustrup ("da man")
Once you have passed the beginner's stage, and have entered the intermediate stage, you should try most of these books:
"C++ Common Knowledge: Essential Intermediate Programming" by Stephen C. Dewhurst
"C++ Coding Standards: 101 Rules, Guidelines, and Best Practices" by Herb Sutter and Andrei Alexandrescu
"The C++ Standard Library: A Tutorial and Reference" by Nicolai M. Josuttis
"Modern C++ Design: Generic Programming and Design Patterns Applied" by Andrei Alexandrescu
I also recommend two series, Herb Sutter's "Exceptional" series:
"Exceptional C++: 47 Engineering Puzzles, Programming Problems, and Solutions" by Herb Sutter
"More Exceptional C++" by Herb Sutter
"Exceptional C++ Style : 40 New Engineering Puzzles, Programming Problems, and Solutions" by Herb Sutter
and Scott Meyers' "Effective" series:
"Effective C++: 50 Specific Ways to Improve Your Programs and Design (2nd Edition)" by Scott Meyers
"More Effective C++: 35 New Ways to Improve Your Programs and Designs" by Scott Meyers
"Effective STL: 50 Specific Ways to Improve Your Use of the Standard Template Library" by Scott Meyers
As for programming tools, there's nothing wrong with using vi or emacs for editing and make for project management. But there's also nothing wrong with using Anjuta or KDevelop. Try them all out until you find something you're comfortable with.
Read, code, code, read, code, code, code, read, code, read, code, code, read, code, code ... and soon enough you will become smart thinkink C++ guru with evil Slavic accenkt!
|
|
|
|
08-08-2005, 11:09 AM
|
#10
|
|
LQ Addict
Registered: Jul 2003
Location: London, UK
Distribution: Slackware
Posts: 7,466
Rep: 
|
For a beginner, I recommend "Beginning ANSI C++: The Complete Language" by Ivor Horton. Personally, I find it very easy to follow and it doesn't require any previous programming experience.
|
|
|
|
| Thread Tools |
Search this Thread |
|
|
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
All times are GMT -5. The time now is 06:29 AM.
|
|
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.
|
Latest Threads
LQ News
|
|