Make 文件无法创建目标文件

Make file is failing to create object files

基本上我正在尝试制作一个简单的 make 文件,该文件创建一个 lexer.o,然后创建一个 driver.o 文件,将它们组合成一个可执行文件。

下面的代码显示了已经尝试过的内容。 运行 它在 Windows powershell 中使用 GNU make。

.PRECIOUS = driver.cpp lexer.h lexer.cpp

lexer.o: lexer.cpp lexer.h
    g++ -o $@ -c lexer.cpp

driver.o: driver.cpp lexer.h
    g++ -o $@ -c driver.cpp

lex.exe: lexer.o driver.o
    g++ -o $@ $^

clean: 
    $(RM) *.o lex.exe

这是给出的输出。我期待它创建 lexer.o 文件,但它不能 "find" 它应该创建的文件。

g++ -o lexer.o -c lexer.cpp
process_begin: CreateProcess(NULL, g++ -o lexer.o -c lexer.cpp, ...) 
failed.
make (e=2): The system cannot find the file specified.
make: *** [lexer.o] Error 2

它最终只是一个 G++ 安装问题。我切换到 Ubuntu 并重新安装了所有东西,它工作正常。