Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum. |
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.
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.
|
|
01-05-2009, 11:40 AM
|
#1
|
Member
Registered: Apr 2004
Distribution: Debian
Posts: 177
Rep:
|
Learning C++ on linux..
Greetings..
I am trying to lean C++ and I want to do it on linux I seem to have the program because when I save the file as .cpp the letters change collars as they did on windows when I was studding on it.. (any how I am thinking that all I need to do to compile it is run it on Terminal, how ever I do not know how to do that what do I type?...
thank you all..
|
|
|
01-05-2009, 11:44 AM
|
#2
|
Senior Member
Registered: Dec 2005
Location: London, ON, Canada
Distribution: Arch, Ubuntu, Slackware, OpenBSD, FreeBSD
Posts: 1,853
Rep:
|
To compile a C++ source file (assuming there is is only one source file):
Code:
$ g++ -o progName main.cpp
The "-o progName" section means that progName will be the created, executable file. If you do not specify the "-o" option, the executable will be called "a.out".
For more than one file, just keep listing them after main.cpp. And "main.cpp" is just the assumption of the main source file for your program.
Last edited by indienick; 01-05-2009 at 11:45 AM.
|
|
|
01-05-2009, 11:51 AM
|
#3
|
Member
Registered: Apr 2008
Location: Toulon (France)
Distribution: FEDORA CORE
Posts: 493
Rep:
|
Google for "C++ linux tutorial", I'm sure you'll find plenty of.
Some advices:
-Understand what "objects oriented programming" is, this is the most (IMHO) difficult part of the learning process, and finally can be understand with a "easier" language like python or java, I really advice you to not learning C++ if you're a programming beginner.
-Learn how the compilation process work, the only efficient way to do this is to write your Makefile by hand, and don't use IDE like KDevelop, Anjuta or other Eclipse. When you'll understand what are dependencies, linkage and others compilation black magics, then try some IDE and pick the one you prefer.
-I repeat it: I think that C++ is really a bad language for a beginner, its syntax is awful, it's easy to make procedural (read not object oriented programming) and you're easily disturbed by problems like memory allocation and others...
|
|
|
01-05-2009, 12:12 PM
|
#4
|
LQ Guru
Registered: Dec 2007
Distribution: Centos
Posts: 5,286
|
Quote:
Originally Posted by phoenix_wolf
I seem to have the program because when I save the file as .cpp the letters change collars as they did on windows when I was studding on it.
|
If I understand you correctly, you think the behavior of some text editor when it sees the extension .cpp indicates that you have the required Debian packages installed for compiling C++ programs.
I don't know if you have the required packages installed. I don't think the behavior of that text editor tells you if you have the right packages installed.
Probably some Debian expert here can tell you which packages you need (though in the Synaptic package manager it should be pretty obvious).
Quote:
Originally Posted by jf.argentino
Google for "C++ linux tutorial", I'm sure you'll find plenty of.
|
I think that's good advice and not too far off from what the OP needs.
Quote:
I really advice you to not learning C++ if you're a programming beginner.
|
I sure hope you don't manage to sidetrack this thread into another fight over that question. I strongly disagree, but I don't want to argue it here. That's not the advice the OP is looking for.
Quote:
-Learn how the compilation process work, the only efficient way to do this is to write your Makefile by hand, and don't use IDE like KDevelop, Anjuta or other Eclipse.
|
I disagree with that advice also (though that advice is not off topic to the original question).
My best guess based on what the OP said is that he would be better off installing and using some IDE such as KDevelop.
I think the question implied (a bit unclearly) by the OP, was which Debian packages should be installed in order to compile C++ and help in learning C++.
Hopefully someone who knows Debian package names will give a clearer answer.
Last edited by johnsfine; 01-05-2009 at 12:27 PM.
|
|
|
01-05-2009, 12:19 PM
|
#5
|
Member
Registered: Apr 2004
Distribution: Debian
Posts: 177
Original Poster
Rep:
|
thank you all..
and thankyou jf.argentino for the suggestions that I do python or java first.. Ill go and search those out (just one question about them is there any that is a better one to start with or does it matter?)...
|
|
|
01-05-2009, 12:19 PM
|
#6
|
Senior Member
Registered: Dec 2005
Location: London, ON, Canada
Distribution: Arch, Ubuntu, Slackware, OpenBSD, FreeBSD
Posts: 1,853
Rep:
|
The big difference between Windows and Linux when it comes to filetypes (MIME types), is that it becomes application-centric to recognize various MIME types in Linux and in Windows, MIME types are (usually) provided by the application that uses them.
Python is super-easy, so if you have never done any programming before, Python is probably going to be your best bet.
Personally, I do not like Python, but I do write in Java a fair bit - its syntax and semantics are much closer to C++ than Python is.
Last edited by indienick; 01-05-2009 at 12:21 PM.
|
|
|
All times are GMT -5. The time now is 08:19 PM.
|
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
|
|