在一个 Eclipse 项目中构建多个二进制文件 [英] Building multiple binaries within one Eclipse project

查看:25
本文介绍了在一个 Eclipse 项目中构建多个二进制文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何让 Eclipse 在一个项目中一次构建多个二进制文件(无需手动编写 Makefile)?

How can I get Eclipse to build many binaries at a time within one project (without writing a Makefile by hand)?

我有一个 CGI 项目,该项目导致 Web 服务器运行多个 .cgi 程序,以及它们使用的几个库.用于构建它的手工 Makefile 慢慢变得不可维护.我们使用 Eclipse 的内部构建"来构建所有其他项目,我们也更喜欢在这里使用它,但为了我的利益,我找不到如何让 Eclipse 构建多个小程序而不是链接所有内容成一个二进制文件.

I have a CGI project that results in multiple .cgi programs to be run by the web server, plus several libraries used by them. The hand-made Makefile used to build it slowly becomes unmaintainable. We use Eclipse's "Internal Build" to build all other projects and we'd prefer to use it here too, but for the good of me, I can't find how to get Eclipse to build multiple small programs as result instead of linking everything into one binary.

推荐答案

此处描述的解决方案:http://tinyguides.blogspot.ru/2013/04/multiple-binaries-in-single-eclipse-cdt.html.有一段摘录:

Solution for this described there: http://tinyguides.blogspot.ru/2013/04/multiple-binaries-in-single-eclipse-cdt.html. There is an excerpt:

  1. 创建托管项目(文件 > 新建 C++ 项目 > 可执行文件)
  2. 添加包含多个 main() 函数的源代码
  3. 转到项目 > 属性 > C/C++ 常规 > 路径 &符号 > 管理配置
  4. 为每个可执行文件创建一个构建配置并为其命名(您可以克隆现有配置,如调试和发布).
  5. 在项目资源管理器中,右键单击包含 main() 函数的每个源文件 > 资源配置 > 从构建中排除并排除所有构建配置,除了使用此 main() 函数构建可执行文件的配置外
  6. 默认情况下,所有其他代码都包含在所有构建配置中.您可能需要根据您的应用程序更改此设置.
  7. 您现在可以通过转到项目">构建配置">设置活动"、项目">构建项目"来为每个主要功能构建一个可执行文件

这篇关于在一个 Eclipse 项目中构建多个二进制文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆