make clean + make distclean (automake工具)

对要编译的.cpp要加入到Makefile.am上面

格式如下:

bin_PROGRAMS =  可执行文件名

***_SOURCES = 所有要参加编译的.cpp文件,文件之间用空格隔开
LIBS = -lpthread -L/usr/local/lib -lpcap –lz //加入库
DEFS += -DNORMAL
DEFS += –DPDEBUG //打开调试信息 定义DPDEBUG
INCLUDES = -I../include //将上级的include路径引进来
#INCLUDES = $(DEPS_CFLAGS)

#LDADD = $(DEPS_LIBS)

 

 

02-12-12, 00:47

今天我编译esound的时候,没有注意到其依赖于audiofile,以致出错。编译好audiofile后,回来重新编译esound,仍然有以下错误:
(cd .libs && rm -f libesddsp.so && ln -s libesddsp.so.0.2.29 libesddsp.so)
ar cru .libs/libesddsp.a esddsp.o
ranlib .libs/libesddsp.a
creating libesddsp.la
(cd .libs && rm -f libesddsp.la && ln -s ../libesddsp.la libesddsp.la)
gcc -DHAVE_CONFIG_H -I. -I. -I. -DSYSCONFDIR=/"/etc/" -DSERVERDIR=/"/usr/bin/" -g -O2 -c esdcat.c
/bin/sh ./libtool --mode=link gcc -g -O2 -o esdcat esdcat.o libesd.la
gcc -g -O2 -o .libs/esdcat esdcat.o ./.libs/libesd.so
./.libs/libesd.so: undefined reference to `afGetSampleFormat'
./.libs/libesd.so: undefined reference to `afReadFrames'
./.libs/libesd.so: undefined reference to `afGetChannels'
./.libs/libesd.so: undefined reference to `afCloseFile'
./.libs/libesd.so: undefined reference to `afGetRate'
./.libs/libesd.so: undefined reference to `afGetFrameCount'
./.libs/libesd.so: undefined reference to `afOpenFile'
./.libs/libesd.so: undefined reference to `afGetTrackBytes'
collect2: ld returned 1 exit status
make[2]: *** [esdcat] Error 1
make[2]: Leaving directory `/usr/src/esound-0.2.29'
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory `/usr/src/esound-0.2.29'
make: *** [all-recursive-am] Error 2
正无奈的时候,决定删除这个目录(我想make clean也是可以的),重新解包、编译,竟然成功了!请问这个“undefined reference to”何解?


tram

02-12-12, 08:32

是这样的,你安装了audiofile后,esound并不知道,因为它的configure脚本已经运行了,并生成了makefile,所以要make clean+make distclean,有时这样也不管用,有的包提供的make clean和make distclean脚本不能把生成的代码完全删除,最干净的方法就是重新解压。我觉得内核的make mrproper可能是最完善的脚本了,能把生成的东西全给删了。undefined reference就是缺少类型定义,一般是少头文件。

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 2
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值