Page 1 of 1
Eclipse: Importing an existing project
Posted: Thu Mar 12, 2009 12:39 pm
by Solar
I repeatedly considered doing my development work in Eclipse, using the CDT C/C++ plugin. However, I utterly failed in getting the idea of how to integrate an existing build system (i.e., Makefile, or even autoconf / automake) properly imported, so I could trigger builds from within Eclipse. Tutorials I found on the web were always like, "it's so easy, just click here and here and there you are", but I always ended up with nothing more but the source files in the Navigator, and scratching my head how to get to my Makefile targets (or my ./configure / make) to where they belong (the "Makefile Targets" tab?).
I simply couldn't figure out how that tab worked...
Can anybody shed some light on this?
Re: Eclipse: Importing an existing project
Posted: Mon Mar 16, 2009 6:13 pm
by frank
Two things to start off with, make sure it's a C/C++ project and that you are in the C/C++ perspective. From there I can right click on the project name in the navigator and go to the C/C++ Make projects tab to change the make preferences. Then I can go to the projects menu on the main program and press Rebuild All to build the project.
Also try manually setting the path to the compiler and linker in the Make tab, it wasn't importing the default path correctly for me, that setting is in the Environment tab within the C/C++ Make projects tab.
One additional thing, the folder I set as my workspace directory actually contains my source files. I don't think that's the way it is supposed to be but it works for me.
I hope you can get everything working because to me personally Eclipse is one of the best IDEs for C.
Re: Eclipse: Importing an existing project
Posted: Mon Mar 16, 2009 11:49 pm
by Solar
Oops, I forgot I asked that here...
I found out why it didn't work for me. (Should've posted it here.)
Yes, if your top-level directory contains a Makefile and all you want is target "all", everything's OK out of the box. But for my projects, that isn't the case. I found out that you have to
create the desired make targets in the "Make Targets" tab,
in the directory the Makefile is residing in. Then you can trigger the target by double-clicking it.
Now, I have to find out how to run ./configure with the proper parameters, automatically, from within Eclipse...
Re: Eclipse: Importing an existing project
Posted: Tue Mar 17, 2009 2:29 pm
by frank
If your ./configure options are constant then you could try setting up another Make Target and changing the build command. If the options are different then you could try to make a script that figures out the proper options and then set that as the build command.
EDIT: Do you need to run ./configure before every build? Maybe you could try changing the build options in the project menu to run configure then make.
Re: Eclipse: Importing an existing project
Posted: Wed Mar 18, 2009 2:22 am
by Solar
No, the options are constant (per platform). Thanks for the hint with the build options.