undefined reference to `___assert_fail'

 `___assert_fail'错误
关于这个错误,首先说一下我遇到的现象。
自己编写的makefile文件,然后在编译以及链接的时候出现错误,下面是错误信息:
bfin-uclinux-g++ -c -Wall broadcast.cpp camera.cpp connect.cpp image_processing.cpp main_class.cpp main.cpp thread.cpp  -Ioscar/include -I/usr/include -I/usr/local/include  -I/home/oscar/opencv-2.x.x/include/opencv -I/home/oscar/osc-cc/modules/leancv/include -I/home/oscar/osc-cc/modules/leanXoverlay/include -DOSC_TARGET -D'APP_NAME="cnt"'
make: [thread.o] Error 127 (ignored)
bfin-uclinux-g++ -elf2flt="-s 1048576" -o   cnt broadcast.o camera.o connect.o image_processing.o main_class.o main.o thread.o  -lm -lbfdsp -lpthread -lcv -lcvaux -lcxcore -lrt oscar/library/libosc_target_dbg.a  -L/home/oscar/oscar/library  -L/home/oscar/opencv-2.x.x/build-target/src/.libs -losc-cc_leancv_target_dbg -losc-cc_leanXoverlay_target_dbg -L/home/oscar/osc-cc/library  
image_processing.o: In function `drawSquares(_IplImage*, CvSeq*)':
image_processing.cpp:(.text+0xb3e): undefined reference to `___assert_fail'
image_processing.cpp:(.text+0xbac): undefined reference to `___assert_fail'
image_processing.cpp:(.text+0xc1c): undefined reference to `___assert_fail'
image_processing.o: In function `CImageProcessor::find_black_trigon_point(_IplImage*, CvMemStorage*)':
image_processing.cpp:(.text+0x1128): undefined reference to `___assert_fail'
image_processing.cpp:(.text+0x118a): undefined reference to `___assert_fail'
image_processing.o:image_processing.cpp:(.text+0x11ee): more undefined references to `___assert_fail' follow
collect2: ld returned 1 exit status
make: *** [all] Error 1

这里主要是下面这些错误。网上百度以及谷歌时候都发现,提示的信息甚少,但是还是从里面得到一些提示
以下是找到有提示信息的连接:
http://blog.csdn.net/jerryutscn/article/details/4602061
http://lists.busybox.net/pipermail/uclibc/2002-February/002657.html

通过阅读,大概知道是连接的库或者是编译器的问题,于是,我怀疑是编译器有问题,因为目前的工程都是
有一个默认的编译器,只是我屏蔽不用,并没有真正的去掉。还有就是连接的库的问题了,我一直以为是链接的问题
因为,从上面的提示可以知道,编译时没有问题的,于是在这里纠结了很长时间。

真的问题是库的混合问题。但是不是链接的lib库,而是编译的-I 库问题,这个库混合了(其实也不是很懂,但是问题就出在这里)mixing libraries
因为-I/usr/include -I/usr/local/include (编译的时候)这两个库,(/usr/lib. /usr/local/lib. /lib链接的时候)是编译器默认搜索的库,所以在一般的情况下是不用增加的。
就算加上了,在某些情况下也不会出错(只有用到某些函数才会出错)。而在我自己编写的makefile里面恰好就是在编译的外部链接库里面引用
了这两个库。
于是出现了所谓的混合现象!应该是这样理解。

于是我把makefile的-I/usr/include -I/usr/local/include 去掉,结果编译连接通过了。


undefined reference to `___assert_fail'
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值