Eclipse makefile中的默认值是"all:"吗? [英] Is 'all:' is default in Eclipse makefile?

查看:268
本文介绍了Eclipse makefile中的默认值是"all:"吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在Eclipse中有c ++ makefile项目. Makefile包含以下行:

I have c++ makefile project in Eclipse. Makefile contains lines:

executable:
    $(COMPILER) $(CFLAGS) aaa.cpp -o aaa.o
    $(COMPILER) aaa.o -o aaa.exe -ldl

Eclipse对可执行文件不满意并显示错误;

Eclipse is not happy with executable and shows error;

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

如何告诉Eclipse使用executable代替all?

How to tell Eclipse to use executable instead all?

推荐答案

虽然我不使用Eclipse并且无法告诉您如何更改默认的构建目标,但是拥有目标all可能是值得的这是很常见的事情.

While I don't use Eclipse and couldn't tell you how to change the default build target, it may be worthwhile to have a target all since it's a pretty common thing to have.

只需将all指定为第一个目标:

Just specify all as the first target:

all: executable

作为第一个目标,当在命令行上未指定任何目标时,它也是默认目标.由于该规则没有命令,因此它所做的全部取决于构建的executable,从而有效地成为别名.为了更加安全,请添加

As the first target it's also be the default target when no target is specified on the command line. Since the rule has no commands, all it does is depend on executable being built, effectively becoming an alias. To be extra safe, add

.PHONY: all

某处(或现有的.PHONY行,如果已有的话),以使文件all的存在不会阻止构建.

somewhere (or to existing .PHONY lines if you already have them) so that the existence of a file all won't prevent building.

这篇关于Eclipse makefile中的默认值是"all:"吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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