如果操作系统是 Windows,我试图在我的代码中添加 .exe 扩展名。 生成文件代码:
check_os:
ifeq ($(OS),Windows_NT)
g++ hello.cpp -o hello.exe
else
g++ hello.cpp -o hello
endif
all: check_os
但我收到此错误:
ifeq (Windows_NT,Windows_NT)
process_begin: CreateProcess(NULL, ifeq (Windows_NT,Windows_NT), ...) failed.
make (e=2): Systemet finner ikke angitt fil.
make: *** [Makefile:2: check_os] Error 2
我尝试搜索,但找不到任何好的答案
您只需移除一层填充物即可:
check_os:
ifeq ($(OS),Windows_NT)
echo windows
else
echo not windows
endif
all: check_os
ifeq
现在降低了 1 个 TAB