Linux Development – How to Tackle Massive Linux/Makefile Projects Effectively

clinux

I have been developing Windows applications in C++ for like 10 years now. And recently I've started digging into some Linux projects, and I can't stand how unproductive I am…

I'm a fast learner, and I've been using Linux as a primary platform for some time now. And I do feel very comfortable with shell, OS principles and GUI. But when it comes to development, it feels like I'm back to school.

As soon as I open some larger project, I'm stuck. Most of them are makefile based, so basically when I try to navigate them with QT or CodeBlocks, at best, I can use intellisense on a per-file basis. And most of the time variables leak from scope.

Then there is a go-to-definition stuff, which seems nonexistent, try to join some larger project from sourceforge, and you're stuck for days, because navigating to definitions is so hard… grep -r "this_def" . --include "*.cpp" --include "*.h" seems so slow and clumsy.

And then, the debugging, gdb does work, but no matter what I do, it seems like it's light years behind WinDbg or VisualStudio debugger.

And these things are making me desperate, I want to write code, but it just goes so slow… I'm starting to think that Linux developers learn function definitions by heart and analyze code by eyes, but I can't believe it's so.

Has anyone gone through this? Is there something that I'm missing that could make me more productive?

Best Answer

Interestingly enough I periodically have the same problem in the opposite direction. I'm primarily a UNIX coder, but I periodically have to port stuff to Windows. I can't tell you the number of times I've wanted to pull my hair out because I can't find the appropriate check box for a compiler option buried in one of 35 preference setting pages for a project. I'd rather just open up the proj file and add the XML myself.

Moving in either direction, the secret is to have patience, and learn the tool set for the platform you are trying to work in. Of course you are going to be frustrated, it's new, and it's unfamiliar, and you are reduced to newbie status all over again. There is no way to avoid this.

In your particular case there are some additional tools you should be aware of. The first is DDD, a GUI front end for gdb. It's not as slick as Visual Studio, but it will hold your hand. However, I'd really recommend biting the bullet, and set about learning the ins and outs of gdb. In truth, if you are a regular user, there isn't a lot of difference between memorizing which commands to type vs memorizing which dialog box you have to bring up to change a setting.

You also need to know about tools like CScope and CTags. As much you may resist, I would suggest learning VIM or EMACS. They integrate well with tag tools I just mentioned. When in Rome, do as the Romans do. You can find extensions for VIM and EMACS that will do code completion for you. My own experience with tools that offer code completion is is that yes, it does saving some typing, but in general typing is easy. Thinking is what's hard. Your opinion may differ, particularly if you have carpal tunnel syndrome.

As for make. Make is admittedly horrible, but you probably just going to have to suck it up and learn it.

Related Topic