离开目录......?

发布于 2024-07-22 04:41:59 字数 112 浏览 2 评论 0原文

当我使用 makefile 编译代码时(我有 12 个 makefile),出现错误提示 make.exe[1]:离开目录错误2这是什么原因? 另外“错误2或错误1”是什么意思?

When I am compiling my code with makefiles (I have 12 makefiles) there is an error telling
make.exe[1]: Leaving directory Error 2 what is the reason for this?
Also what does the "Error 2 or Error 1 " mean?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

只是偏爱你 2024-07-29 04:41:59

当 make 在此上下文中打印“Error 2”时,仅意味着递归 make 调用中出现错误。 您必须查看该消息之前的错误消息,以确定子制作中真正的问题是什么。 例如,给定一个像这样的 Makefile:

all:
        $(MAKE) -f sub.mk

... 和一个像这样的 sub.mk:

all:
        @exit 1

当我运行 GNU make 时,它​​会打印以下内容:

gmake -f sub.mk
gmake[1]: Entering directory `/tmp/foo'
gmake[1]: *** [all] Error 1
gmake[1]: Leaving directory `/tmp/foo'
gmake: *** [all] Error 2

Error 2 告诉我存在某种错误在子品牌中。 我必须查看该消息上方的子制作本身的 Error 1 消息。 在那里我可以看到,在尝试构建 all 时调用的一些命令以退出代码 1 退出。不幸的是,除了简单的“退出代码 0 表示正常”之外,并没有真正定义应用程序退出代码的标准。 您必须查看失败的特定命令并检查其文档以确定特定退出代码的含义。

正如其他人所说,这些错误消息与 Unix errno 值无关。 最外面的“2”只是子make发生错误时make自身分配的错误代码; 内部的“1”只是失败命令的退出代码。 它也可以很容易地是“7”或“11”或“42”。

When make prints "Error 2" in this context it just means that there was an error in a recursive make invocation. You have to look at the error messages preceeding that message to determine what the real problem was, in the submake. For example, given a Makefile like this:

all:
        $(MAKE) -f sub.mk

... and a sub.mk like this:

all:
        @exit 1

When I run GNU make, it prints the following:

gmake -f sub.mk
gmake[1]: Entering directory `/tmp/foo'
gmake[1]: *** [all] Error 1
gmake[1]: Leaving directory `/tmp/foo'
gmake: *** [all] Error 2

Error 2 tells me that there was an error of some sort in the submake. I have to look above that message, to the Error 1 message from the submake itself. There I can see that some command invoked while trying to build all exited with exit code 1. Unfortunately there's not really a standard that defines exit codes for applications, beyond the trivial "exit code 0 means OK". You have to look at the particular command that failed and check its documentation to determine what the specific exit code means.

These error messages have nothing to do with Unix errno values as others have stated. The outermost "2" is just the error code that make itself assigns when a submake has an error; the inner "1" is just the exit code of a failed command. It could just as easily be "7" or "11" or "42".

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文