小编Sla*_*lay的帖子

编译错误的文件?

我有3个文件 - SwimMill.c,Fish.cPellets.c- 每个文件都被编译成可执行文件.当SwimMill运行时,它使用fork()exec()运行FishPellets.但是,出于某种原因,当我使用终端时,首先使用make,然后运行SwimMill文件来编译程序Fish.有谁能够帮我?

Makefile文件

all: SwimMill Fish Pellets

SwimMill: SwimMill.c
    gcc -o SwimMill SwimMill.c

Fish: Fish.c
    gcc -o Fish Fish.c -lm

Pellets: Pellets.c
    gcc -o Pellets Pellets.c
Run Code Online (Sandbox Code Playgroud)

SwimMill.c

// Uses both fish and pellets, 30 seconds, then print it out
// Create pellets at random intervals, from 0x80
// Eating --> Get rid of most significant bit
// …
Run Code Online (Sandbox Code Playgroud)

c fork makefile shared-memory

8
推荐指数
1
解决办法
89
查看次数

标签 统计

c ×1

fork ×1

makefile ×1

shared-memory ×1