小编kjs*_*kjs的帖子

如何在ubuntu中运行makefile

有两个简单的.c文件add.c和hello.c.这是我的makefile-

all:  add.exe hello.exe

add.exe: add.o

    gcc -o add.exe add.o



hello.exe: hello.o

    gcc -o hello.exe hello.o



add.o: add.c 

    gcc -c add.c



hello.o: hello.c 

    gcc -c hello.c
Run Code Online (Sandbox Code Playgroud)

make终端上键入它显示所有这四个命令,但当我尝试使用./all它运行它说

bash: ./all: No such file or directory. 
Run Code Online (Sandbox Code Playgroud)

./hello.exe./add.exe工作正常.

当我在朋友的电脑上输入./all时,它会显示正确的输出.

在此输入图像描述

bash ubuntu makefile

4
推荐指数
1
解决办法
4万
查看次数

标签 统计

bash ×1

makefile ×1

ubuntu ×1