Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Building a multi module C project (i.e. solution) with Eclipse CDT

I am moving from Netbeans to Eclipse (on Ubuntu 12.0.4). I have a C application that consists of several sub projects which are libraries (shared and static), as well as stand alone executables.

I can't figure out how to create a 'parent' project foo, which contains component projects

  • foobar
  • foofoo
  • barfoo
  • barbar

Ideally, I want all the 'component projects' to be created under the folder foo, so that I have a directory structure like this:

  • /path/to/foo/foobar/ (contains foobar project files)
  • /path/to/foo/foofoo/ (contains foofoo project files)
  • /path/to/foo/barfoo/ (contains barfoo project files)
  • /path/to/foo/barbar/ (contains barbar project files)

Does anyone know how I can achieve this structure using Eclipse as IDE (with CDT)?

Last but not the least, I intend to create my C modules using the Autotools option. Will the generated files for Autotools be automatically updated as I add new header/source to a module - or do I need to manually maintain the Autotool files?

like image 971
Homunculus Reticulli Avatar asked May 17 '13 01:05

Homunculus Reticulli


2 Answers

Friend, I think there is no the "parent" C project. You can create a normal C project in IDE and add all dependencies into sub-folders. Then tell compiler your build procedure via Makefile. I think it's easy way as you have had experience on C application.

About autotools, once you update/add/remove your project file, I think you need to modify your Makefile to reflect your change and do clean and rebuild your project.

For other C build tools, you can use buildroot if you'd like.

like image 105
Happyday Avatar answered Oct 12 '22 19:10

Happyday


The best way I can think to do this in eclipse is to create a separate workspace for the project e.g. foo, and then add the sub-projects (foobar, foofoo, etc...) as projects. This is generally a better approach to take with eclipse, instead of a single monolithic workspace. I don't know what the specific dependency structure for the sub-projects looks like, but you should be able to express it simply by using eclipse project properties. This can include a rollup executable sub-project that depends on the libraries.

Unfortunately, I'm not sure if eclipse cdt will maintain autotools files. However if not, it should be relatively easy to integrate and use some of the autotools binaries such as autoscan, and autoheader into the eclipse build commands.

like image 23
Jason Avatar answered Oct 12 '22 18:10

Jason