ProgrammingThis 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.
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.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
I just started teaching myself c++ and have been doing most of my compiling on a windows machine. I thought I would give it a try with linux but am having problems.
wont compile. I have seen posts about dropping the h from the iostream and "include namespace std" but none of that seems to work either. I though c++ was supposed to be pretty platform independant. I really dont want to have to learn to code one way for windows and another for linux.
Last edited by crisponions; 07-04-2003 at 01:42 AM.
Originally posted by Cyclo If you want to make GUI programs, try using Qt - free and simple
QT is fun and simple enough (I'm learning it now...sort of...off and on) but I think it would be important to get the basic C++ down first before trying to use a toolkit like that so that you can understand how the toolkit is doing what its doing no?
Originally posted by Cyclo my basis for recommending it is it drastically simplifies string handling etc, and it's tutorials are relatively good.
also, great book is "Learn C++ for linux in 21 days"
For THAT I agree...in fact I just managed to get my first QT project to work today so I'm pretty jazzed about it (Its just a dinky little thing but it's fun to work on...). I'm really liking the QString class now that I have the hang of it, although I stand by what I said, QT isn't for someone who doesn't know the basics...BUT, once you know..it's easy to get into...
A great book that I recommend (along with the others mentionned which I also have) is Tom Swan's 'GNU C++ for Linux'. Until I had found that book I had been rather frustrated by the windows-centric leanings of the other books (although that's a minor gripe since by and large, C++ is C++ for the basics). This book is totally awesome for the beginner programmer using linux. If you have to choose only one book, that's the one I'd go with.
Well, I tried compiling your 'hello world!' code with gcc (>gcc test.cpp) and got a whole load of linker errors. I'm hardly an expert myself and I'm not sure why they're there.
Just using the c++ compiler worked fine (>c++ test.cpp), although you will need to add the 'using namespace std' into your code. That might do you for a while but you really should be able to use gcc.
What distro do you use (I'm using mandrake)?
Anyone else out there that's cleverer than me care to shed some light on the situation?
Well, I tried compiling your 'hello world!' code with gcc (>gcc test.cpp) and got a whole load of linker errors. I'm hardly an expert myself and I'm not sure why they're there.
Just using the c++ compiler worked fine (>c++ test.cpp), although you will need to add the 'using namespace std' into your code. That might do you for a while but you really should be able to use gcc.
What distro do you use (I'm using mandrake)?
I am using RedHat 9. The g++ compiler took care of my problem.
So am I correct in assuming gcc is for c programs?
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.