gpt4 book ai didi

c - 使用 Eclipse CDT 组织遗留 C 项目

转载 作者:太空宇宙 更新时间:2023-11-04 04:35:00 26 4
gpt4 key购买 nike

我有一个很大的遗留项目(C ANSI,在 90 年代早期为支持 POSIX 的 SCO/Xenix 编码)。该项目基于以下结构:

+ 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)
|
|...

每个模块可以有几十个可执行文件,其他模块有很多普通的.c和很少的可执行文件。并且有几十个模块。

这个项目可以通过遗留脚本构建,但现在使用 gcc 和 gmake,但还不是很好,我们正在缓慢迁移,没有对结构进行大的修改以保持脚本工作。

现在,我们正在推广“Eclipse with CDT”IDE 的使用,并且一个项目到每个可执行文件的概念在这个项目中不太容易适应(查看模块组织)。

有没有办法将同一文件夹中的多个可执行文件源分别映射到多个 eclipse 项目?欢迎提出更多建议。

注意:请记住,我们需要让遗留脚本运行一段时间,直到我们确定新的组织/结构/技术可以有效地构建所有二进制文件。

最佳答案

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

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

关于c - 使用 Eclipse CDT 组织遗留 C 项目,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31681965/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com