7

I am a brand new engineering student, my teacher told us that we need to program in C++, I am new to programming and to Ubuntu, I am installing the latest version of Ubuntu but I would like to know what else do I need to program in C++, I've been told to install Kate, can you please tell me what else I need? and where to find documentation related to programming and the programs I need? than you very much!

  • 1
    You should ask this on the coding stackexchange. Your question has no relation to Ubuntu by itself (you can code on any OS). – Rinzwind Jan 14 '12 at 18:32
  • 4
    What you need is a platform (Ubuntu), an editor (like Kate but that is KDE. You can also use gedit. Have a look in ubuntu software center for editors ;) ) and some manuals or tutorials to start ( cplusplus.com/doc/tutorial ). and of you go!! – Rinzwind Jan 14 '12 at 18:34
  • 4
    A c++ compiler is a pretty good thing to have as well. – Zoke Jan 14 '12 at 18:47
  • @Rinzwind: cplusplus.com has quite a few errors and some terrible examples; anyone who actually wants to learn is far better off getting themselves a good book. – Anton Golov Jan 14 '12 at 23:33
9

You'll need to :

  • write code: a text editor of your choice (gedit by default or xemacs, vi, etc...) or an IDE (i'll recommend codeblocks or Eclipse + eclipse-cdt, etc.)
  • manage your code: aka use a Version Control System, optional at first while learning but you'll benefit from knowing git or mercurial once you'll start working on non-trivial projects.
  • compile code: install build-essential (includes g++, make, C headers, etc., don't go for a manual install of the compiler) sudo apt-get install build-essential
  • debug it: don't think you'll ever be able to skip this step ^^ sudo apt-get install gdb
  • 2
    LMGTFY is not polite. – jrg Jan 18 '12 at 0:09
  • Look, considering i took some time to politely answer the question, i could just have said "google for some c++ tutorials to learn the language once you've installed everything you needed, i won't write one because the are lot of them around the web" but instead preferred to add a lmgtfy link to point out that i don't want to pollute my answer with info easily available with a search engine. So please, consider this a humorous note because so was my intention. I'm aware this can be use in a rude way but so are many of the words we use ^^ – Maxime R. Jan 18 '12 at 0:42
  • There are also many people that found it funny ;) meta.stackexchange.com/q/15650/155165 – Maxime R. Jan 18 '12 at 0:43
  • @MaximeR I found it funny, however, not everyone else does. :) – jrg Jan 18 '12 at 0:44
  • Don't want to start an edit war with you but please let the people who really find it rude free to make their point as i could also say that thinking for us/them is not polite ;)(sorry but always been careful with the don't worry, we think for you orwellian ideology) – Maxime R. Jan 18 '12 at 1:02
5

You need an editor (Use one you like, gedit is preinstalled for Ubuntu, I, myself, prefer SciTE) and a c++ compiler.

The c++-compiler (g++) is found in the package g++. I would however recommend installing the package build-essential, it will install some more useful packages.

g++ can be invoked on the command-line like this: g++ source.cpp -o myprogram

Later when your programs will get more functions you will probably need some extra libraries. You can find them most easily via apt-cache search. Library packages have the suffix -dev or the prefix lib, e.g. zlib1g-dev for the compression library.

2

I would recommend to install eclipse if you intend to start coding in c++. It is a good IDE to familiarize yourself with as it has support for Java and Python among others to consider for the future; also it is the best supported IDE for developing android apps.

sudo apt-get install eclipse

Not the answer you're looking for? Browse other questions tagged or ask your own question.