【发布时间】:2018-10-26 12:36:05
【问题描述】:
我在 VS 代码中编译 c++ 程序时遇到了一些麻烦。我跟着这个答案:How do I set up Visual Studio Code to compile C++ code?
我的 Makefile 是
CC=g++
CFLAGS=-Wall
.SUFFIXES = .cpp
objs:=$(wildcard *.cpp)
targets:=$(objs:.cpp= )
.PHONY:all
all: $(targets)
.cpp:
$(CC) $(CFLAGS) -std=c++11 -o $@ $<
我只想编译这个在当前窗口中打开的文件,比如 1.cpp,这个文件没有任何外部依赖
当我尝试编译我的文件时(按我链接的答案中给出的 f8)我收到以下错误:
'make' is not recognized as an internal or external command,
operable program or batch file.
我是初学者,对 Makefile 了解不多,我们将不胜感激。
谢谢!
编辑:
我正在使用用于 linux 的 Windows 子系统来编译我的程序,而不是 mingw 或 cygwin。
【问题讨论】:
-
你可能需要自己安装make
-
@JETM 我已经安装了(请看这个:stackoverflow.com/questions/11934997/…)
-
我正在使用 linux(bash) 的 windows 子系统作为终端来编译我的程序
-
那么问题是VSCode没有在正确的地方寻找make。我不知道更多,但也许这个线索可以帮助你搜索。
-
make Makefile是一个非常糟糕的命令,可能会覆盖您的 makefile。你想要的是make -f Makefile
标签: c++ makefile compiler-errors visual-studio-code