In the Eclipse CDT Resource Share Folder, built differently for the project

I have a set of Eclipse c projects that will reference a common common code base (a combination of .c and .h files in the same folder), but this code will be built differently based on each project.

The general code base can be edited within each project, but these changes will be corrections that will be carried over in all projects. The general code will not diverge on one project, except for the build options through define.

If I create a project for this library, this means that I do not need the assembly of the library. I need the resulting object files for landing in the project for which they are being built. Therefore, the c / C ++ project does not make sense.

The general code will be checked for reverse subversion (like every project). I could use New Folder β†’ Associated Resource, but I would prefer that projects not depend on the directory structure that the developer used.

Is there a clean way to do this?

Thanks.

+2
source share
1 answer

I'm not sure if this will work for your version of Eclipse or for CDT (I tested it with Java), but it looks like you need to create a second source folder. Since the source folder is usually private for the project in which it exists, you need to create a linked folder ... (from your description above, I think you may have already done this, but to complete the answer I have included the following steps).

I did it as follows:

  • Create a new item in your project
  • Select a folder (not the source folder, but just the folder)
  • In the dialog box for creating a folder, click the "Advanced β†’" button and select the "Link to a folder in the file system" check box.
  • Click Browse and select the folder with the shared source files.
  • Click Finish

Now you have a simple folder, but to include files in a folder in your compilation (at least in Java it works like this) you need to create a source folder:

  • Create a new item in your project
  • Select "Source Folder"
  • Click Browse next to the Folder Name text box.
  • Select a new linked folder

Now, in my version of Eclipse and in Java, this folder is included in code compilation. I hope it works the same in CDT ...

If you run the OS with real symbolic links (Linux, OSX?), You can also use the symbolic folder in your project for an additional source folder, and then you can simply perform the β€œSource folder” - creating the steps above.

If your version of Eclipse does not have a Browse button in the Create Source Folder dialog box, just try entering the same name in the text box.

Hi,

/ E

+3
source

All Articles