Foreach循环在Makefile中不起作用:“系统找不到指定的文件". [英] Foreach Loop Not Working in Makefile: "The system cannot find the file specified"

查看:195
本文介绍了Foreach循环在Makefile中不起作用:“系统找不到指定的文件".的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个包含以下内容的Makefile:

I have a Makefile of the following content:

NUMBERS = 1 2 3 4
lib:
    $(foreach var,$(NUMBERS),./a.out $(var);)

这是我运行的命令(与Makefile位于同一目录)

And this is the command that I run ( in the same directory as the Makefile)

make -f Makefile

但是我收到一条错误消息,提示系统找不到指定的文件".

But I got an error message saying that "The system cannot find the file specified".

遵循

Following the suggestion of one of the answers, I created the following file inside the same directory as the Makefile:

a.out
1.out
2.out
3.out
4.out

现在错误变为:

./a.out 1; ./a.out 2; ./a.out 3; ./a.out 4; make(e = -1):错误-1 make: *** [lib]错误-1

./a.out 1; ./a.out 2; ./a.out 3; ./a.out 4; make (e=-1): Error -1 make: *** [lib] Error -1

注意:我正在Windows XP平台上运行

推荐答案

make的目的是通过运行命令来创建(和更新)依赖于源文件的目标文件.

The purpose of make is to create (and update) target files that depends on source files by running commands.

在这里,问题出在运行的命令上.您正在尝试运行(通过make)命令a.out,但该命令不存在或不是可执行命令.尝试用要运行的实际可执行命令替换makefile中的a.out.

Here, the problem is with the command that is run. You are trying to run (through make) the command a.out but it does not exist, or is not an executable command. Try to replace a.out in your makefile by the actual executable command you want to run.

这篇关于Foreach循环在Makefile中不起作用:“系统找不到指定的文件".的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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