views:

343

answers:

8

I am starting to write a moderately sized project in C++ requiring a fairly large amount of files and dependencies on other projects.

Do you think manually maintaining a Makefile for this project is the best approach?

Are there other better alternatives for C++ that make build management and dependency management of files really easy to handle?

Also, what IDE is good for C++ development on Linux? I am comfortable with Vim, but do you think there are good IDEs for C++ (like Eclipse for Java) that provide code-completion etc?

Thanks! Ajay

+3  A: 

KDevelop4 (from subversion or rc1 from their site) + CMake makes life so much easier, automake should just die. If you want a cross-platform solution, netbeans + the c++ plugin are pretty decent, not as good as kdevelop4 though.

OneOfOne
+1  A: 

Eclipse does C++ as well - through eclipse CDT - not as comprehensive as Java but pretty good.

Dipstick
For reference: http://eclipse.org/cdt/
Suppressingfire
+3  A: 

I suggest you Code::Blocks. I use it on Debian and works gracefully.

http://www.codeblocks.org/

Edit: Added another link http://wiki.codeblocks.org/index.php?title=The%5Fbuild%5Fprocess%5Fof%5FCode%3A%3ABlocks

Salv0
Code blocks looks good!Does it manage dependencies too? Or I will still have to use CMake along with it?
ajay
Yes of course, you can set dependencies in this way: right-click the project and choose Properties -> Build targets and click on"Dependencies. Check also http://wiki.codeblocks.org :)
Salv0
+2  A: 

I like CMake a lot for the whole building process (but I have almost no experience with scons or Jam).

I use vim or qtcreator. Qtcreator is still in developpment, but very promising I think.

Tristram Gräbener
+1  A: 

Manually maintaining Makefiles in larger Projects becomes quite painful. If you start using automake/autoconf, you will - after a while of learning all the facets - appreciate the powerful possibilities these tools can offer.

And as IDE simply use Emacs. It's quick, powerful and supports Code completion etc.

struppi
A: 

There's also Code::Blocks as an IDE with its own building system. But I would encourage you to try out other build tools (CMake, Boost.Build, SCons) if you want to be able to build your software "anywhere" without having a fancy schmancy IDE installed. ;-)

sellibitze
A: 

I found Emacs + Scons works pretty well for me.

Ben Collins
+3  A: 

Others have already recommended using CMake. To my mind you should manage your project with CMake then decide on your favourite IDE.

CMake allows you to describe the project to be built, instead of how to build it. For example: I want to create a shared library called foo with source files a.cpp, b.cpp and c.h and it requires these link dependencies. Then on unix you get libfoo.so and on windows you get foo.dll and foo.lib. All common project settings can be abstracted up to higher levels in the build tree, this keeps most files very simple. More complicated requirments can be refactored into macros.

Once your project is described like this CMake will generate makefiles and/or IDE projects. This means each developer can choose their own IDE, as well as allowing you to mandate an IDE if appropriate.

My company use CMake to build the c++ in our product on windows and solaris. It contains 600 projects and 1.5 million lines of source code. We originally chose it as a cross platform build utility when porting to solaris, however for a large project like ours it is much easier to manage the build with CMake than with Visual Studio project files. I would recommend it as a build utility for any c++ project of any size

We use the eclipse cdt on solaris and are very happy with it. Most of our development is with visual studio on windows. cmake also works well with other ides I use it with KDeveloper4 on linux at home without a hitch.

iain
Not to mention that KDevelop 4 was designed to natively integrate fully with CMake, providing great features.
Ramon Zarazua