24

I recently started using Linux as my primary OS. What are the tools that I will need to set up a complete programming environment in Linux for C and C++?

16 Answers 16

21

Standard stuff:

  • The compiler tools, gcc, gdb, etc.
  • Some sort of editor/IDE (emacs, vim, eclipse)
  • Profiling tools
  • Source Control (SubVersion, git, etc)
  • Language specific tools, like easy_install for python (you said C/C++, but the same goes for everything)
  • A web server maybe? Apache, Lighttpd, nginx
  • Any libraries you'll be using. Are you doing kernal hacking? Driver development? opengl?
1
  • 3
    the ', etc.' is missing 'a build environment', like autotools, cmake, etc. Aug 13, 2010 at 14:51
6

Among others you should also have gprof and valgrind ( or something in it's class ).

5

Vi (or emacs), gcc , make
Tradiationally unix development is more commandline than ide. There are very good IDEs, the main ones are probably eclipse and kdevelop

3

It depends on your definition of "Complete programming environment", and whether you are using C, C++, or both (C/C++ is an awful term that shouldn't be used. Either it's C, or C++).

If you are looking for an IDE, Eclipse/CDT is the most highly-recommended one from my experience (I don't actually use any IDE, so I can't offer first-hand advice).

If you can cope with command-line control (and in the end I find it makes things easier to do and doesn't take a whole lot of getting used to), a simple text editor with highlighting will suffice. I prefer KATE (part of KDE), as it features a built-in terminal as well as many features you would expect from an editor inside an IDE, like code folding and regex search/replace.

Many people also recommend Vim or Emacs, both of which are probably available through your distro's repositories. (Eclipse is probably available too, but in my experience the CDT is confusing to install via packages. YMMV). They are both ancient editors; and there is a powerful holy war between the two, so I won't get involved.

Your compiler should probably be GCC - on a Debian system, installing the g++ package as well as build-essential should be enough to get C++ going (build-essential should contain the gcc package required for C development). Whatever your distro, GCC is probably easily available or else already on your system.

3

Seconding swilliams, I'd say the basics are:

  • an editor or IDE (I use vim),
  • a compiler (almost certainly gcc)
  • make, or maybe some other similar tool like ant if you want
  • a debugger (almost certainly gdb)
  • source control (I use subversion)
  • Standard unix utilities like grep and diff, but you have those already

Other than that, I'd say install as you go. Linux is more about little utilities that each do one thing than monolithic development environments that do everything. So if you find yourself needing something, you can always just install it, be that thing a memory profiler, a documentation generator, a bigger/smaller/more different editor, et cetera, et cetera.

2

What distribution are you running?

In Ubuntu or any Debian based distribution you can issue the following command to install all the necessary tools.

sudo apt-get install build-essential

From there you can install your SCM solution of choice and an IDE if you prefer or just use your favorite text editor.

0
1

The simplest of answers is an editor (take your pick - at least one is already on there) and gcc/g++.

If you want an IDE, there are a slew of questions related to that on SO :) (including this one C++ IDE for Linux?).

1

Kdevelop is a well regarded and well written IDE for Linux, installing it should get you every other tool you might want to develop with installed as well and and IDE to go with it.

By "every other tool" I mean gcc, grep, diff, autoconf et al should be grabbed by the package manager and installed at the same time, but I could be wrong. I don't have a standard distro on hand to test that with.

Personally, I use vim, but I have used kdevelop in the past.

vim/vi is handy because you know that some form of vi is always available on every unix platform.

  • I have to correct my post. I just looked at the package requirements for kdevelop on ubuntu... it does NOT appear to require gcc and install it automatically
1
  • vi might be on every Unix, but it's not on every GNU/Linux - it's fully possible to set up a system with only emacs and no vim, especially if you're using a very customizable distro like Gentoo.
    – Branan
    Oct 21, 2008 at 17:00
1

If you want something very easy to use, with ability to import visual studio projects, and a feel much like VS, give Codeblocks a try. Its quick ( since its not Java based ) and in general works well.

1

Another great utility that you can use are *nix man pages. Each function in the C library has an associated man page.

For example:

man printf

man strncpy

...

0

I took an old windows laptop with a dead hard drive and replaced the hard drive then installed Ubuntu (linux / debian all in one handy release) on it. I had to burn the ubuntu installation files onto a cd first on another working computer.

Here's where I got my linux from (complete with desktop gui, very easy to install, lots of programs to use, it was my first linux but not my first unix):

http://www.ubuntu.com/getubuntu/download

Then i installed Netbeans for my integrated development environment (IDE) altough I am using it for java -- but it comes with c++ support as shown below:

http://www.netbeans.org/features/cpp/

I also installed mySql, you didn't ask, but that is another key component that completes my development environment.

Good luck to you.

0

On most distros, everything you need will be installed by default (very few don't include gcc, they all include some kind of editor). I generally do my development in Vim (or gVim, which is the graphical version -- the best of both worlds). For those times when I'm feeling the need for a "real" IDE, Eclipse with the Vim plugin is really nice. It's almost like working in Vim, except you get the Eclipse stuff -- again, best of both worlds. The Vim plugin for Eclipse that I'm using is not free, however :( I believe there is a free one, but the last time I tried it, it wasn't very good.

1
  • "On most distros, everything you need will be installed by default" -- This is not as true as it once was.
    – Steve S
    Jan 9, 2009 at 21:52
0

Personally I use Ubuntu w/ Eclipse CDT. Eclipse is what most people might think of as a Java IDE, but CDT is a set of extensions that really tune it for C/C++ development. It's smart enough to figure out what toolset to use (MacOSX GCC vs Linux GCC, for example).

Eclipse CDT Website

For best results, currently the 6.0 JRE for Ubuntu seems to have problems with recent Eclipse versions, so what I did was remove the 6.0 JRE and run:

apt-get install build-essential sun-java5-jre sun-java5-bin

Then grab the latest Eclipse from the website, unpack it in a directory.

As a final touch, edit the eclipse.ini file that comes with Eclipse and add this line to it:

-XX:CompileCommand=exclude,org/eclipse/core/internal/dtree/DataTreeNode,forwardDeltaWith

This will further stabilize the app, making it as rocksolid as Windows or Mac.

If you prefer commandline tools over GUI tools, some ones I use regularly:

  • CMake -- Portable build tool. It's easy to use and can output a variety of formats like Makefiles or Visual Studio files.

apt-get install cmake

  • Vim -- VI improved, if you want a text editor with some bells and whistles. Otherwise, just use 'nano', which comes with Ubuntu.

apt-get install vim

0

Twe options, you must make your decision now and never look back, or risk being burned at the stake:

a. Emacs b. vi(m)

Do not listen to any rational arguments before choosting... listen to the light inside yourself...

0

Install a lot of bell a whistles for the editor you choose, vi is usable but no fun. vim is fun, but vim with extras is great.

(And the same is true for Emacs even if that means installing tetris and a doctor ;-) )

/Johan

0

Two must haves are guake and pithos. I cant see how any one can have a list of dev tools without these.

2
  • 1
    This is a comment, not an answer. Nov 24, 2012 at 3:04
  • Its an answer with a comment. I fail to see how me listing two things that are nice to have in a dev environment a comment. I could have listed the staples such as gcc and vim but I thought it would be redundant. Or were you stating that your comment was a comment and not an answer? If so thanks for the clarification.
    – Moziac
    Nov 24, 2012 at 3:29