gpt4 book ai didi

Windows 崇高文本 3 "make: *** No targets specified and no makefile found. Stop."

转载 作者:可可西里 更新时间:2023-11-01 10:36:09 24 4
gpt4 key购买 nike

很多人显然出于某种原因遇到了这个问题,但我还没有找到适用于我的特定案例的任何已回答问题。如果有一个我错过了,我当然会很感激被指出来(最好是以一种尊重的方式)。

如问题所示,我在 Windows 7 x64 机器上使用 Sublime Text 3(稳定版,Build 3059)。我正在为我的项目使用 make 构建系统,因为这是我工作时在 Mac 上使用的系统,虽然它不一定在 Windows 上最有意义(没有双关语意),但它确实应该使用正确的设置。我意识到我可以通过不使用 make 来避免这个问题,但我更愿意了解问题是什么而不是(或除此之外)只是做其他事情。以下是来自命令行的一些信息(即普通的 Windows 命令提示符):

C:\Users\xt\code\d3>where make
C:\cygwin64\bin\make.exe

C:\Users\xt\code\d3>echo %path%
C:\Users\xt\AppData\Roaming\npm;C:\Cygwin64\bin\;C:\Python27\;C:\Python27\Script
s\;C:\Program Files (x86)\AMD APP\bin\x86_64;C:\Program Files (x86)\AMD APP\bin\
x86;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\
WindowsPowerShell\v1.0\;C:\Program Files (x86)\ATI Technologies\ATI.ACE\Core-Sta
tic;C:\Program Files\nodejs\;C:\Program Files (x86)\Git\cmd;C:\Program Files (x8
6)\Git\bin;C:\julia;C:\Users\xt\AppData\Roaming\npm

请注意,Windows 在 C:\cygwin64\bin\make.exeC:\Cygwin64\bin\ 中找到了 make 命令也在我的路径中。我不认为大小写差异是问题,因为 Sublime Text 并不是在提示无法找到 make,而是在提示找不到 makefile。

这是我正在使用的目录结构

C:\Users\xt\code\d3>ls -R
.:
Makefile README.txt coffee css index.html js license.txt

./coffee:
index.coffee

./css:
style.css

./js:

请注意,Makefile 实际上存在于 d3 目录中。

我在Sublime Text中打开d3目录如下:

  1. 从“开始”菜单打开 Sublime Text
  2. 在 Sublime Text 中,文件 > 打开文件夹... > C:\Users\xt\code\d3
  3. 点击边栏中的Makefile

Makefile 的内容如下:

.PHONY: all
all: js/index.js

js/%.js: coffee/%.coffee
coffee -co $(@D) $<

.PHONY: clean
clean:
rm -r js

郑重声明,每个配方行都以 TAB 字符开头,而不是空格。

查看 Tools > Build Systems 显示我当前的构建系统是Automatic。运行构建产生以下输出:

make: *** No targets specified and no makefile found.  Stop.
[Finished in 0.2s with exit code 2]
[shell_cmd: make]
[dir: C:\Users\xt\code\d3]
[path: C:\Cygwin64\bin\;C:\Python27\;C:\Python27\Scripts\;C:\Program Files (x86)\AMD APP\bin\x86_64;C:\Program Files (x86)\AMD APP\bin\x86;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Program Files (x86)\ATI Technologies\ATI.ACE\Core-Static;C:\Program Files\nodejs\;C:\Program Files (x86)\Git\cmd;C:\Program Files (x86)\Git\bin;C:\julia;C:\Users\xt\AppData\Roaming\npm]

因此,它找到了 make 命令,并且它从 C:\Users\xt\code\d3 目录运行,如前所述,该目录确实包含一个名为 Makefile 的生成文件。

当我在命令行上尝试同样的操作时,我得到以下信息:

C:\Users\xt\code\d3>make
coffee -co js coffee/index.coffee

...并且,确认成功的结果:

C:\Users\xt\code\d3>ls -R
.:
Makefile README.txt coffee css index.html js license.txt

./coffee:
index.coffee

./css:
style.css

./js:
index.js

我尝试通过创建一个新的构建系统(工具 > 构建系统 > 新构建系统...)来调试 Sublime Text 中的制作过程,保存为 C:\Users\xt\AppData\Roaming\Sublime Text 3\Packages\User\Make (debug).sublime-build 包含以下内容:

{
"shell_cmd": "make -dr"
}

当我尝试使用这个新的构建系统 Make (debug) 进行构建时,我得到以下结果:

GNU Make 4.0
Built for x86_64-pc-cygwin
Copyright (C) 1988-2013 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Reading makefiles...
Updating makefiles....
Considering target file 'GNUmakefile'.
File 'GNUmakefile' does not exist.
Looking for an implicit rule for 'GNUmakefile'.
No implicit rule found for 'GNUmakefile'.
Finished prerequisites of target file 'GNUmakefile'.
Must remake target 'GNUmakefile'.
Failed to remake target file 'GNUmakefile'.
Considering target file 'makefile'.
File 'makefile' does not exist.
Looking for an implicit rule for 'makefile'.
No implicit rule found for 'makefile'.
Finished prerequisites of target file 'makefile'.
Must remake target 'makefile'.
Failed to remake target file 'makefile'.
Considering target file 'Makefile'.
File 'Makefile' does not exist.
Looking for an implicit rule for 'Makefile'.
No implicit rule found for 'Makefile'.
Finished prerequisites of target file 'Makefile'.
Must remake target 'Makefile'.
Failed to remake target file 'Makefile'.
make: *** No targets specified and no makefile found. Stop.
[Finished in 0.2s with exit code 2]
[shell_cmd: make -dr]
[dir: C:\Users\xt\code\d3]
[path: C:\Cygwin64\bin\;C:\Python27\;C:\Python27\Scripts\;C:\Program Files (x86)\AMD APP\bin\x86_64;C:\Program Files (x86)\AMD APP\bin\x86;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Program Files (x86)\ATI Technologies\ATI.ACE\Core-Static;C:\Program Files\nodejs\;C:\Program Files (x86)\Git\cmd;C:\Program Files (x86)\Git\bin;C:\julia;C:\Users\xt\AppData\Roaming\npm]

不出所料,make 找不到GNUmakefilemakefile,但由于某种原因它找不到Makefile,尽管声称在 [dir: C:\Users\xt\code\d3] 中运行。为了进行比较,这里是相应的命令行输出:

C:\Users\xt\code\d3>make -dr
GNU Make 4.0
Built for x86_64-pc-cygwin
Copyright (C) 1988-2013 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Reading makefiles...
Reading makefile 'Makefile'...
Updating makefiles....
Considering target file 'Makefile'.
Looking for an implicit rule for 'Makefile'.
No implicit rule found for 'Makefile'.
Finished prerequisites of target file 'Makefile'.
No need to remake target 'Makefile'.
Updating goal targets....
Considering target file 'all'.
File 'all' does not exist.
Considering target file 'js/index.js'.
Looking for an implicit rule for 'js/index.js'.
Trying pattern rule with stem 'index'.
Trying implicit prerequisite 'coffee/index.coffee'.
Found an implicit rule for 'js/index.js'.
Considering target file 'coffee/index.coffee'.
Looking for an implicit rule for 'coffee/index.coffee'.
No implicit rule found for 'coffee/index.coffee'.
Finished prerequisites of target file 'coffee/index.coffee'.
No need to remake target 'coffee/index.coffee'.
Finished prerequisites of target file 'js/index.js'.
Prerequisite 'coffee/index.coffee' is older than target 'js/index.js'.
No need to remake target 'js/index.js'.
Finished prerequisites of target file 'all'.
Must remake target 'all'.
Successfully remade target file 'all'.
make: Nothing to be done for 'all'.

在这里,make 找到了 Makefile,就在我们知道的地方。这就是我达到众所周知的技巧的尽头的地方。

所以...感谢所有费心阅读所有这些内容的人,感谢您的反馈。

最佳答案

检查行尾,因为 Windows、Linux 和 Mac 使用不同的行尾。

view -> Line endings 中更改行结束设置尝试使用不同的选项并检查(可能是它的 Windows,切换到 Mac 并检查一次)。

关于Windows 崇高文本 3 "make: *** No targets specified and no makefile found. Stop.",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25478201/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com