Advertisement

Flexible C++ linux IDE (a specific problem)

Started by September 13, 2004 09:35 PM
22 comments, last by GameDev.net 20 years, 2 months ago
Thanks for the tips. There are a lot of great text editors (especially ones targetted at programmers) but I'm particularily worried about managing makefiles. I guess one of the reasons is that I'm new to unix development and know little about them so they scare me [smile] In particular, I'm quite ignorant about the purpose of automake and its proper usage (and whether I need it at all). Whenever I get the chance (tonight or tomorrow) I'll try KDE as well as hp's makefile and see where that gets me. If managing makefiles really doesn't require that much work, I may actually go with a good text editor instead of a fully featured IDE.
Quote: Original post by hplus0603
You don't need to add files or fix dependencies or anything.

The trick is to use the "wildcard" rules of GNU make, and to use the "-MMD" option of gcc to emit a ".d" file together with the .o files. Then use -include in the Makefile to include the .d files; if they're not yet generated, then that won't be an error, but that also means that the .o files are not generated, so the target will be re-built no matter what.

*** Source Snippet Removed ***


Wow, hplus0603, this trick is awesome. i knew the -M option of gcc; i had a make target which i had to call manually, something like:

gcc -M *.cpp *.c > Makefile.in

and then

~include Makefile.in

in my Makefile. this sucked, and it didn't work when i changed include files in other directories... Thanks, you get the best rating i can offer :)

chris
Advertisement
Quote: Original post by CoffeeMug
Thanks for the tips. There are a lot of great text editors (especially ones targetted at programmers) but I'm particularily worried about managing makefiles. I guess one of the reasons is that I'm new to unix development and know little about them so they scare me [smile] In particular, I'm quite ignorant about the purpose of automake and its proper usage (and whether I need it at all). Whenever I get the chance (tonight or tomorrow) I'll try KDE as well as hp's makefile and see where that gets me. If managing makefiles really doesn't require that much work, I may actually go with a good text editor instead of a fully featured IDE.


By the way, please don't think that all the Linux programmers use applications like Emacs. :) I find it ones of the most unintuitive programs I've ever used in my life. Applications like Anjuta, JEdit, Kate, Eclipse, KDevelop etc. are far easiest to use and just as good.



Makefiles are a little scary at first, but they are very flexible and powerful. For example, you can add targets for running unit tests, deploying your server over the network etc. Once you've found a script for compiling and linking your project, you never have to think about it again so don't worry about the odd syntax.

Combine all this with version control systems like CVS and you have a very powerful development environment. You might miss the all in one IDEs like MSVC, but I find this approach of using many small but specialised tools together much more flexible.
Sean, then what is the purpose of automake? Should I bother with it or just bite the bullet, learn the GNU makefile syntax, build it once and forget about it?
Quote: Original post by CoffeeMug
Sean, then what is the purpose of automake? Should I bother with it or just bite the bullet, learn the GNU makefile syntax, build it once and forget about it?


I'm not sure to be honest. :)



I grabbed black magic code like hplus0603 uses, put it in a makefile and never thought about it again. I work with many different languages so I've never spent the time to understand how code like that works.



Just go through some makefile tutorials to get to grips with it. The only things you really need to know are targets (what task depends on what other task, how it is achevied and what files they produce), macros (like C macros) and apart from that it's just a straight forward script file. They can look very cryptic though, so don't be put off. Unless you're doing something special, you should just be able to take someone elses generic makefile and change some path names to get it working.
You may want to check out Jam as well. It makes maintaining project files a lot easier then dealing with Makefiles. We use it on our projects with no problems. You can even define your own rules for building different targets.

I've heard that you can setup Anjuta to use jam but I've never tried it. I use vim/kate most of the time.

-----------
Andrew
Advertisement
Hey, I just thought I'd throw my $0.02 worth in as well. I have tried several IDE's in Linux and I must say that the best thing I have found is Source Navigator by RedHat. You can find it at:

http://sourcenav.sourceforge.net/

It hasn't been updated in over a year, but it is stable and works well. About the only thing it doesn't provide is code-completion and *intellisense* stuff. Then again, is there anything on linux that actually provides this stuff that is on par with Visual Studio? Haven't found it yet...

The only downside to the program is that you are working on a very large project, it sometimes takes a little while to load a symbol's cross-reference (where the symbol is defined, etc).. Then again, I was using SNavigator with Torque, and that's huge...

Anyways, maybe it's for you, maybe not... just thought I throw that out there.. I've tried Anjuta, KDevelop, etc, and I always find something wrong...

-Greg
Quote: Original post by CoffeeMug
Sean, then what is the purpose of automake?

In short, it takes the verbosity out of writing good, flexible makefiles. Automake ends up outputting a "GNU style" makefile that checks dependencies and does everything the correct way for the list of files you tell it to handle. So, you do end up telling it which files to handle (without outside tools; but it's really easy once you have it down), but automake does the rest of the work turning it into a huge makefile.

Like others have said, there are alternatives to makefiles (e.g., jam) that do make things more simple (and, arguably, more easy). I stick with makefiles because they do what I need simply and they fit together perfectly with the rest of a GNU build environment (as one would hope).
automake also does the most important thing of all:

simplify installation.

automake does it all for you. and defines some macros that say where stuff was installed.

That's REALLY what automake does. the rest could easily be done with autoconf and a simple makefile.
Well, I tried out a lot of different things today and I think I found a winner. I'm pretty excited about this little piece of software and I strongly encourage everyone to try it.

Parinya.

I won't talk much about the features, you can read about them on the site. I'll mention my opinion of what I've seen so far. Very lightweight (starts up in less then a second on my Athlon 750, Anjuta takes about 5-10 seconds). The GUI isn't very pretty (but in my experience linux IDEs generally aren't). Creates project templates very quickly (as opposed to 30 seconds in Anjuta) and compiles immediately (no make, config, etc.) Allows exporting makefiles whenever necessary. Has limited autocompletion. The GUI feels like MSVC (the menu structure is similar, even some icons and shortcuts are similar). Allows me to put my files wherever I like (unlike Anjuta). Integrated debugger seems pretty good (from what I've tried so far). Code editor is nice (keyword highlighting, block collapsing, tabs).

Please, if you develop for linux, download it and take a look. This is exactly what I've been looking for and I'd feel bad if people didn't discover it. This may be exactly what you need.

Thanks everyone for your responses. After I get further into my project I'll post my experiences about setting up everything necessary for cross platform development. May be an article or something. Let me know if you think that would be useful.

This topic is closed to new replies.

Advertisement