10

I am working on C++ and COM/ATL in Windows from last few years. Now I want to shift to Linux Programming. I know basic architecture of Linux. I did some of the projects which are using ncurses, sockets and audio libraries(Terminal Applications). On which tool I should be familiar to start with projects. In windows I have started with Win32 Programming then moved to COM and ATL. Win32 Programming gave me the insights of Windows.

Can you give me the steps to start with Linux Programming?

3
  • What exactly do you mean by professional projects? I know of a number of script-based tools that are used by professionals, and so could be called professional projects. But also, each project will have a best tool, so what kind of projects, Music, Gui, Server, Graphics, games?
    – cdeszaq
    Oct 16, 2008 at 16:36
  • Consider a more descriptive title for your question. Oct 16, 2008 at 16:52
  • 1
    Don't. Write all code cross platform so it is valid win/lin/bsd/mac. Jan 25, 2009 at 12:28

11 Answers 11

13
  • gcc/g++
  • understand shell basics: probably bash (typically the default)
  • make (you don't have to be an expert, or even use it in your own work, but you should understand it)
  • a scripting language (bash, ruby, python, tcl, perl; you choose)
  • basic unix command line utilities (ls, cd, etc....)
  • an editor: vi or emacs are the most popular choices.
  • linux. your distribution in particular (ubuntu is popular; you may want to start there). know how to tweek your environment and how to fix things when they break.

The rest depends on what you want to do.

You do not need to be an expert at any of this; you will learn over time.

3
  • 1
    he asked how to start programming( not bash one-liners)
    – Quamis
    Jan 7, 2009 at 12:46
  • 1
    He has clearly tagged his question with C/C++, why are you suggesting bash, ruby, python e.t.c????
    – kazanaki
    Apr 30, 2012 at 12:01
  • Knowing the C/C++ APIs on linux only gets you part of the way -- typically you need to know about shell scripting so you can write the build scripts, install scripts, etc. Aug 30, 2013 at 10:02
12

Depends what you're trying to do...

Are you going to be doing GUI apps? Learn Qt or GTK or wxWidgets. Are you going to be doing device driver development? Learn straight C, not just C++. A lot of the exciting software development under Linux happens in Python and Perl (and other dynamic languages to a lesser extent), so you should almost certainly learn one of those.

8

The pragmatic answer

I understand why you ask your question this way but Linux is not Windows, so there is really no straight answer. Actually we are talking about GNU/linux + all the free software ecosystem, so what you have to learn depends very much of what you want to do.

If you are more into system programming, you will look at the linux kernel and need to work on your C skills.

If your want to code utilities, scripting languages (especially ruby and python) will be your tools of choice, and you'll have to choose a GUI framework on top of that (GTK, QT and wxWidget show the way).

If it's more about web and network programming : python, ruby, php or java can do it.

The good news

In the Linux env, you have the choice because of lot of people use a lot of different tools. It can seems messy, and often is, but it works not so bad.

So stop thinking about what you must learn and focus on 2 questions :

  • do I want to join a project ? Then the techno will be choosen by the project you join. So choose a project using a tech YOU WANT to learn.
  • do I want to start my own project ? Then the techno will be choosen by the existing tool you will rely on. Most of the time, you will have the choice, so enjoy your new freedom and learn the tech YOU WANT.

Free, as in freedom mate, means you can choose.

3

Start reading the book Advanced Linux Programming which is also available as a free PDF.

Do not fear the advanced keyword. From the details of your post (ncurses, sockets) you are already "advanced".

You can also look later at the glib library (Standard component of GTK+/GNOME but also used in command line applications.)

If you absolutely have to program in C++, read the whole documenation of QT and you are good to go.

2

Read The Art of UNIX Programming http://ecx.images-amazon.com/images/I/51HJF%2B%2BjseL._BO2,204,203,200_PIsitb-sticker-arrow-click,TopRight,35,-76_AA240_SH20_OU01_.jpg

This will help you understand why things are done as they are in a *unix based system.

1
1

I also recommend you learn the STL and Boost - the latter is especially useful when writing C++ apps in Linux as you get libraries for threading, file system, regex, etc. Plus the code can be ported back to Windows if necessary. This is how I got started in Linux - I took a Windows project and converted to use the STL/Boost and added a browser-based UI. Once it was up and running in Windows - but with no actual Windows specifics in the code - I set about learning the Linux basics (gcc, make, etc.) and got it working very quickly.

1

Draw on your already hard earned knowledge of COM and learn something like TAO. Obviously, there is no ATL or WTL in the unix world... so you'll have to invest time to learn the STL - the good news is STL exists on windows too. Boost will help you go between platforms significantly easier, so you should learn that too.

Beyond that, it really depends on what you want to do.

1

I suggest learning CMake - it's a great cross-platform build tool that is much easier to use than make/autotools.

0

I would recommend you to start by using Gentoo, it should be hard the first weeks, but after a while (say 2 months and less if you have basic linux understand ) you will be able to use every distribution and you will know exactly what will happen and how on your system when you press/digit something, I think that you will be re-paid for this more time (learn gentoo is a bit harder then other distros) spent on Gentoo. And this I think will be helpful when programming for linux.

0

When developing for Linux, I tend to stick with the basics: vim, gcc, gdb (from command line, no front ends), svn, cscope, Valgrind, make (not that I am a big fan of make, I admit). Various graphical front ends exist, and even IDEs, but I don't like any of them.

0

Could you elaborate on the sort of things you hope to do, in as far as Linux programming is concerned? This might have most of what you hope to go through, regardless.

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