c - Eclipse 无法运行我的 Makefile

标签 c eclipse makefile eclipse-cdt

我正在 Eclipse 中编写 C 项目,在尝试运行它时收到以下错误消息:

(Cannot run program "make": Launching failed)

我的 Makefile 是:

all : GenericHashTable.o TableErrorHandle.o
    gcc -Wall GenericHashTable.o TableErrorHandle.o -o all

GenericHashTable.o : GenericHashTable.c GenericHashTable.h TableErrorHandle.h
    gcc -Wall -c GenericHashTable.c -o GenericHashTable.o

TableErrorHandle.o :  TableErrorHandle.c  TableErrorHandle.h
    gcc -Wall -c TableErrorHandle.c -o TableErrorHandle.o

clean :
    rm all *.

最佳答案

您的 makefile 或您的问题中的格式是否损坏?目标和依赖项下方行中的命令。这个 makefile 可以从命令行运行吗?

假设 makefile 是正确的,请检查明显的事情,例如确保 Eclipse 可以看到您的工具链。也许它甚至找不到 make 命令,或者您还没有从首选项中设置它。

此外,CDT 还提供了一个托管 makefile 和一个标准(手动)makefile。托管意味着 Eclipse 将为您创建 makefile。标准 makefile 是您负责编写的 makefile。也许如果您的项目很简单,您应该使用托管 makefile 来避免编写一个的麻烦。

关于c - Eclipse 无法运行我的 Makefile,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3582310/

相关文章:

objective-c - 为什么结构和基本类型不需要指针?

java - 两幅图像之间的碰撞检测

java - Hibernate:在没有 log4j 的情况下禁用日志记录到控制台

c++ - C++ makefile 的 Netbeans 环境变量

检查c数组中添加了多少项?

c - 在 Makefile 中设置变量的规则未按预期工作

php - 如何使用 C 向特定网站发送获取请求?

java - List.sort() NoSuchMethodException 1.6 与 1.8

makefile - make 文件的编译器标志继续

c++ - 尝试在 C++ 中制作 makefile 时出错