tags:

views:

163

answers:

3

I have a project for Linux that i've been developing for some time. Basically it's a bunch of C and H files together with a directory structure and a Makefile.

Every time I need to debug something it's so painful, I need to manually search for var. definitions, structs, etc.

Is there any good IDE out there for Linux that will allow me to import those files into a "project" and that will provide code completion or at least an easy way to get my bearings in the source code?

thanks!

+3  A: 

Eclipse with the CDT

CDT is pretty much Makefile based, just create an empty 'make' project then drop your files into it and refresh in eclipse then add your make targets.

Eclipse should pick stuff up from make output.

Spudd86
Thanks. I installed Eclipse and the plugin (CDT), now what? I've been trying to import those files but nothing. Do you know if there is an import function (i've been adding the files manually)
Jessica
@Jessica Click into the project area, select import, C/C++, "Import existing code as makefile project" You can tweak the details in the project properties once it is created.
Let_Me_Be
ok, I have installed Eclipse 3.5.2 then I added CDT via the "help" install new software. Once that was done I went to "file->import" and selected C/C++ but all I see is either "import application" or "import configuration" which is looking for an XML file
Jessica
What I usually do is make an empty project then just copy stuff into it IIRC the default location will be ~/workspace/<project name>. I've never really found eclipses import features to be terribly useful.
Spudd86
@spudd86, i tried that already but i can't get it to compile and it's no different that just opening the files in VI or gedit or whatever
Jessica
did you refresh in eclipse? (right click on the project and select refresh from the menu, it'll pick up changes that were made outside eclipse that way) Also is the first target in your makefile all or whatever the one is that will build everything? Also make sure that the compiler comandlines are being shown by make as it runs since eclipse needs those to pick up paths and stuff for it's indexer (so it can find headers and figure out other things)
Spudd86
no. but don't need to since I can even get eclipse to read the files as a project.What kind of project are you generating? Can you walk me through the creation and import of files? Or could you point to me website that does?
Jessica
Start eclipse, file->new->C project, in the pop up click the + next to 'Makefile project', select 'Empty Project', select 'Linux GCC' as tool chain, give the project a name (at top), click finish. Then `cp -r <whatever dir your code is in now>/* ~/workspace/<project name>` then refresh in eclipse. If you already have your stuff in ~/workspace/<dir> just make a project with the name of <dir> and it should show up in eclipse (it will warn you about overwriting things, but it shouldn't since it's just going to add some eclipse specific files)
Spudd86
fantastic. that worked!, thanks!
Jessica
+1  A: 

It depends on your definition of "good", but Emacs in connection with Cedet and AutocComplete does a good job in my opinion - but it's not too easy to get used to it.

Another IDE i've used (but not on Linux) is CodeBlocks.

phimuemue
Thanks, but I'll stay away from Emacs, putting aside the fact that I am a VI user I don't want to deal with that program.I tried CodeBlocks in the past but it's not different from Anjuta
Jessica
+1  A: 

There are several ways of going about this:

  • ctags: Most editors have ctags or etags support, which allows you to jump easily around in your source code. The tag file can be built by the makefile.
  • KDevelop: Version 4 is not bad, and is a more integrated IDE if standard text editors aren't your thing.
  • Eclipse with CDT: Eclipse is passable, and will work with C/C++ easily.
  • Emacs: Add CEDET (included in newer Emacs releases) for real code completion.
Yann Ramin
It's not that a standard editor is not my thing, it's just that it is painful to use when debuging. I'm trying to figure out how to use eclipse with cdt but so far no luck.as for Emacs... well, I won't comment.
Jessica
@Jessica: vi/vim has great ctags support, which should allow you to navigate in your source tree easily. It won't have emacs' integration with gdb, but thats the price for simplicity.
Yann Ramin
@theatrus vim is not exactly simple... either in UI or code (and if you look at the actual codesize of the binary it's about the same as emacs... I'm not an emacs user... but I'm also not a vi user either :P)
Spudd86
thanks but as i stated in the question I need an IDE with code completion as well so thanks.
Jessica