Jump to content
  • Advertisement
Sign in to follow this  
CoffeeMug

Flexible C++ linux IDE (a specific problem)

This topic is 5059 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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.

Share this post


Link to post
Share on other sites
Advertisement
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.

Share this post


Link to post
Share on other sites
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...

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
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/*



Share this post


Link to post
Share on other sites
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?

Share this post


Link to post
Share on other sites
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?

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
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 ?

Share this post


Link to post
Share on other sites
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 :)

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!