Creating a project with multiple C modules (i.e. solutions) with Eclipse CDT

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

I can't figure out how to create a “parent” foo project containing project components

  • Foobar
  • foofoo
  • barfoo
  • Barbar

Ideally, I want all the “project projects” to be created in the foo folder, so 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 an IDE (with CDT)?

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

+6
source share
3 answers

Friend, I think there is no "parent" C project. You can create a regular C project in the IDE and add all the dependencies to subfolders. Then tell the compiler about your build procedure through the Makefile. I think this is easy, as you have experience with a C application.

About autotools, as soon as you update / add / delete a project file, I think you need to change your Makefile to reflect your changes, and clean and rebuild your project.

For other C build tools, you can use buildroot if you want.

+1
source

The best way I can think of doing this in eclipse is to create a separate workspace for the project, for example. foo, and then add subprojects (foobar, foofoo, etc.) as projects. This is usually the best approach to use with eclipse instead of a single monolithic workspace. I don’t know what the dependency structure for subprojects looks like, but you can express it simply using the properties of the eclipse project. This may include a library-specific executable.

Unfortunately, I'm not sure that eclipse cdt will support autotools files. Otherwise, however, it would be relatively easy to integrate and use some of the autotools binaries, such as autoscan and autoheader , into eclipse build commands.

+1
source

First you need a working directory , then you need a new project , then per file or per class (according to C ++ or C) add your files, this is a safe way. the other way is not clean, I have experience. do not use them.

+1
source

Source: https://habr.com/ru/post/945212/


All Articles