对于学校作业,我正在尝试使用 Vscode 中提供的 Makefile 编译 C 文件。生成文件包含以下内容:
CFLAGS += -std=gnu11 -g
EXES = greet
all: $(EXES)
clean:
rm -f $(EXES)
greet: greet.c
# don't treat all and clean as file targets
.PHONY: all clean
当我在 VScode 终端中运行 make 时,它给了我: bash: make: command not found
为什么会这样?作业是这样说的:
随附的 Makefile 将构建程序 greet。因此,您可以通过运行 make 来编译程序。make 程序将打印出用于编译程序的每个命令。请注意,如果你连续运行两次 make,第二次它不会做任何事情,因为它知道你的源文件没有改变。使用以下命令运行程序:./greet
我不知道这是否与我在VScode中的tasks.json文件有关?我还遇到了这个 VSCode 扩展:https ://naereen.github.io/Makefiles-support-for-VSCode/ 它说 Vscode 现在有一些内置的东西:https ://github.com/microsoft/vscode/tree/ master/extensions/make 我不知道如何安装它。