c -/usr/bin/ld : cannot find -lioutil in Makefile

标签 c makefile gnu

我想按如下方式执行 makefile,但收到此错误:

gcc frparse.o frtags.o frscan.o frinit.o frstop.o frfoot.o frio.o -L/usr/local/image/lib/sgi -lioutil -lutil -o frparse

/usr/bin/ld: 找不到 -lioutil

collect2:错误:ld 返回 1 退出状态 Makefile:17: 目标 'frparse' 的配方失败 make: *** [frparse] 错误 1

如果你能指导我,我将不胜感激。

IMLIB   = /usr/local/image/lib/sgi
LLIBS   = -lioutil -lutil

it: frparse frcheck pgrep
OBJ = frparse.o frtags.o frscan.o frinit.o frstop.o frfoot.o frio.o


frparse.o: Makefile frparse.h frio.h frproto.h frstop.h frparse.c
frinit.o: Makefile frparse.h frproto.h frinit.c
frscan.o: Makefile frio.h frstop.h frscan.c
frfoot.o: Makefile frparse.h frproto.h frstop.h frfoot.c
frtags.o: Makefile frparse.h frio.h frproto.h frstop.h frtags.c
frstop.o: Makefile frstop.h frstop.c
frio.o: Makefile frio.c

frparse: $(OBJ)
        gcc $(OBJ) -L$(IMLIB) $(LLIBS) -o $@


frcheck: frcheck.o
        gcc frcheck.o -L$(IMLIB) $(LLIBS) -o $@

pgrep: pgrep.o
        gcc pgrep.o -L$(IMLIB) $(LLIBS) -o $@

.c.o:
#   cc -c -O2 -mips2 $<
        gcc -c -g $<

最佳答案

关于:

.c.o:
#   cc -c -O2 -mips2 $< 
    gcc -c -g $<   

评论#还必须通过 <tab> 缩进否则配方永远不会执行第三行

此外,语法有点过时建议:

%.o:%.c

食谱的第一行

但是,关于您的问题:

实际上有一个名为libioutil.so的库文件吗?在目录中:

/usr/local/image/lib/sgi

关于c -/usr/bin/ld : cannot find -lioutil in Makefile,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56115425/

相关文章:

c - Malloc 与 C 中的静态数组

c - 包含 .c 文件的副作用

c - c 中函数不能返回 null

c - 在 C 副作用中存储指向局部变量地址的指针

windows - 如果发生错误,请在 Windows 控制台中暂停 GNU Make

c - Makefile,更好理解规则

C程序可以编译但不能运行

c - 在 C 程序中枚举增补组

gnu - gnu lib math (libm) 源代码在哪里

linux - GUPC 与伯克利 UPC