c++ - Ubuntu 上的 Eclipse : No rule to make target `all' error using existing makefile/project

标签 c++ eclipse-cdt makefile

我正在运行安装了 CDT 的 Eclipse 3.7.2。 Ubuntu 12.04 LTS。

我有一个现有的生成文件 C++ 项目,我正尝试从 Geany 导入它。我可以在项目的根目录中运行 $ make,一切都会按预期构建。

我在 Eclipse 中的错误:

make: *** No rule to make target `all'. Stop.

我的问题:如何消除这个错误?

以下是我正在采取的具体步骤:

  1. 文件>新建>具有现有代码的 Makefile 项目。
    • 现有代码位置设置为项目的根目录。
    • 语言设置为 C++
    • 工具链设置为跨 GCC
  2. 在项目属性>C/C++ 构建中...
    • 在构建器设置中...
      • 使用默认构建命令
      • 不使用自动生成 makefile(不可用)
    • 在行为...
      • 使用构建(增量构建)<< all
      • 使用清洁<<清洁

Eclipse CDT: no rule to make target all接近回答我试图纠正的问题,但我遇到了与 OP 相同的问题:自动生成 makefile 不可用。

我试过了 make: *** No rule to make target `all'. Stop. Eclipse error也是最受好评的解决方案。但是,当我取消选中构建(增量构建)选项时,构建绝对不会执行任何操作,所以这也不对。

最佳答案

我刚刚想出了解决方案。像往常一样,它应该是显而易见的。

make: *** No rule to make target `all'. Stop. Eclipse error评分最高的答案是正确的,但有点含糊。这是解决方案:

  1. 转到“项目属性”>“C/C++ 构建”>“行为”选项卡...
  2. 启用构建(增量构建)
  3. 从文本框中删除“全部”。

错误被抛出是因为 Eclipse 试图找到一个规则来构建“all”,默认情况下它被指定为一个目标。

删除“所有”(并将其他所有内容保留为默认值)告诉 Eclipse 以与从终端调用 $ make 完全相同的方式构建项目。

如果我在这些陈述中有任何错误,请随时纠正我。

关于c++ - Ubuntu 上的 Eclipse : No rule to make target `all' error using existing makefile/project,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17139347/

相关文章:

c++ - dynamic_cast<void*> 什么时候有用?

c++ - 将简体中文GB2312文本字符转换成UTF 8

c++ - 尽管构建成功,但 Eclipse Neon 构建错误

c++ - 关于在包含许多子目录的项目上使用 make 的反馈

makefile - 包括静态库到./configure

makefile - GNU 使 : rebuild when intermediate files are missing

c++ - 初始化和赋值

c++ - 初始化 Eigen::Map 的 std::array

c++ - fatal error : 'type_traits' file not found

c++ - 如何为代码块禁用 Eclipse CDT 代码格式化程序