Organizing legacy C projects with Eclipse CDT

时间:2015-07-28 16:21:09

标签: c unix eclipse-cdt

I have a big legacy project (C ANSI, coded in early 90s for SCO/Xenix with support to POSIX). This project is based in the following structure:

+ h (all common headers)
+ lutil1 (just .c source to build the library)
+ lutil2 (just .c source to build the library)
+ ...(more libs in the same structure)
|
+ moduleA (can have dependency to one or several libs)
|  + several common .h 
|  + several common .c sources 
|  + moduleA-exe1.c (executable depending of some sources in this folder)
|  + moduleA-exe2.c (executable depending of some sources in this folder)
|  + ... (more executables, .c sources with main function)
|
+moduleB (can have dependency to one or several libs)
|  + several common .h 
|  + several common .c sources 
|  + moduleB-exe1.c (executable depending of some sources in this folder)
|  + moduleB-exe2.c (executable depending of some sources in this folder)
|  + ... (more executables, .c sources with main function)
|
|...

Each module can have dozens of executable, others have a lot of common .c and few executable. And there are dozens of modules.

This project can be build through legacy scripts, but now with gcc and gmake, but isn't very good yet, we're migrating slowly, without big modifications in the structure to keep the scripts working.

Now, we're promoting the use of the IDE "Eclipse with CDT", and the concept of one project to each executable ins't very easy to adapt in this project (look the modules organization).

Is there a way to keep multiple executables sources in the same folder mapped to several eclipse projects each one ? More suggestions are welcome.

NOTE: Keep in mind that we need to have the legacy scripts working for some time until we are sure that the new organization/structure/technology can build all binaries effectively.

1 个答案:

答案 0 :(得分:0)

对于具有多个可执行源(main())的模块,我们创建了一个新文件夹来保存所有新的eclipse cdt项目,每个项目使用链接文件映射到各自的文件,这很痛苦。做,但这是我们发现的解决方法。

链接文件可以相对于工作空间,扩展变量。