Advertisement

Flexible C++ linux IDE (a specific problem)

Started by September 13, 2004 09:35 PM
22 comments, last by GameDev.net 20 years, 1 month ago
Is there a flexible C++ linux IDE? I've just encountered a problem with Anjuta that doesn't allow me to store files in my own directory structure. Apparantly Anjuta *requires* my files to be in a SRC directory located in the directory of the project file. Frankly, this requirement is rediculous: I have my files structured according to a specific hierarchy and IDE specific project files are located in one of the folders. It's logical to keep platform independent files *above* that folder but it seems like I can't do that with Anjuta. Does KDevelop allow for flexible directory structures? If not, can someone recommend another IDE? I will install KDevelop tomorrow but I'd like to keep my options open. Also, I am considering using XEmacs for my development needs but being a complete emacs n00b I have a few questions about its C++ development mode. Does it actually maintain makefiles or do I have to do it manually? If someone can give me some overall direction, that'd be great.
anjuta has been a real bitch for me lately, and I've just kinda moved into managing makefiles myself and using gedit.

that's probably not what you were hoping to hear.
Advertisement
Not really [smile] I want to spend my time developing the software, not managing things that can be completely automated by the tools without any real loss of freedom. I'm wondering if emacs can manage makefiles or I have to do it manually...
well, from the pratical side of things...

how often are you adding files to your projects?!

I mean, in the beginning sure, but after that initial phase, generally its jus about coding stuff in the current files.
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.

Here's a sample make file I use (sources go in src/, build stuff that can be cleaned goes into bld/). Any .cpp file in src/ is automatically built as part of the executable "myprog". If you change a header used by any of the cpp files, the right files will get magically re-built!

[source language=make]OFILES:=$(patsubst src/%.cpp,bld/%.o,$(wildcard src/*.cpp))LIBS:=-lstdc++bld/myprog:     $(OFILES)        $(CC) -o $@ $^ $(LIBS)bld/%.o:        src/%.cpp        $(CC) -c $(CFLAGS) -MMD -o $@ $<-include $(patsubst %.o,%.d,$(OFILES))clean:        rm -f bld/*

enum Bool { True, False, FileNotFound };
I'm amazed. I will try your makefile the next chance i have. What's the deal with automake / autoconf if it so easy just with gcc?
Advertisement
Quote: Original post by hplus0603
You don't need to add files or fix dependencies or anything.

Thanks for the great example! I'll try to use it when I get home. If you modify cpp files, this rebuilds the affected modules? Also, out of curiosity, what editor do you use for development?
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.

Here's a sample make file I use (sources go in src/, build stuff that can be cleaned goes into bld/). Any .cpp file in src/ is automatically built as part of the executable "myprog". If you change a header used by any of the cpp files, the right files will get magically re-built!

*** Source Snippet Removed ***


Does this also take into account included headers, e.g. :

main.cpp includes foobar.h which includes bar.h
now if I change something in bar.h, does it rebuild main.o ?
If you haven't tried it already, KDE's Kate is a really powerful and easy to use text editor for multiple file formats. Here's some screenshots.
I've used a good few text editors and IDE's and by far my favorite is JEdit (www.jedit.org), it,s much more user friendly than emacs or vi and has a load of really handy plugins such as FTP file access and Gesture recognition (e.g right click and move mouse up to create a new file etc.)

developing in c++ this year for a year long proj. i'm using
->Jedit
->g++
->makefiles
->ddd (debugger)

and a few other tools

just said i'd throw in my piece :)

This topic is closed to new replies.

Advertisement