CreateProcess failed: The system cannot find the file specified.

在此网站https://www.cnblogs.com/sandeepin/p/ninja.html?ivk_sa=1024320u学习ninja构建项目时
将GCC = D:\MinGW\bin\g++.exe 变量写错路径了,不断报CreateProcess failed: The system cannot find the file specified.
ninja: build stopped: subcommand failed.
一定要将变量GCC的路径写正确,否则就会报一些莫名其妙的错误。

# 指定ninja最小需要版本
ninja_required_version = 1.5

# 变量
GCC = D:\Library\MinGW\bin\g++.exe
cflags = -Wall

# 编译规则,指定depfile,可以用于生成ninja_deps文件
rule compile_jfz
  command = $GCC -c $cflags -MD -MF $out.d $in -o $out
  description = 编译 $in 成为 $out
  depfile = $out.d
  deps = gcc
build jfz.o : compile_jfz src/jfz.c

# 链接规则
rule link_jfz
  command = $GCC $DEFINES $INCLUDES $cflags $in -o $out
  description = 链接 $in 成为 $out
build jfz.exe : link_jfz jfz.o

# 编译all,就是做任务build jfz.exe
build all: phony jfz.exe

# 默认编译什么(单独运行ninja)
default all

猜你喜欢

转载自blog.csdn.net/yangjia_cheng/article/details/122347258