当我编译Makefile进行流程管理时,出现以下错误。目录中也存在liblab1.a
文件。
Compiling server.c
/usr/bin/ld: skipping incompatible ./liblab1.a when searching for -llab1
/usr/bin/ld: cannot find -llab1
/usr/bin/ld: cannot find -lsocket
collect2: error: ld returned 1 exit status
Makefile:8: recipe for target 'server' failed
make: *** [server] Error 1
这是我的Makefile。尽管liblab1.a已放置在文件夹中,但这似乎是某些缺少库文件的结果。
# Makefile for the lab assignment
# You are NOT supposed to modify this
# file.
all: server simplefork crack server1 server2
// server.c compilation
server: server.c netstuff.h liblab1.a
@echo "Compiling server.c"
@gcc -Wall -Werror -o server server.c -L. -llab1 -lnsl -lsocket