'undefined reference to `__ctype_tolower' 或 '__ctype_b'

用make编译一个open client程序时(rh9+sybase12.5),出现错误:
/home/sybase/OCS-12_5/lib/libsybdb.a(dbcursut.o)(.text+0xc7): In function `db__crs_search_phrase':
: undefined reference to `__ctype_tolower'
/home/sybase/OCS-12_5/lib/libsybdb.a(dbcursut.o)(.text+0x133): In function `db__crs_search_phrase':
: undefined reference to `__ctype_tolower'
/home/sybase/OCS-12_5/lib/libsybdb.a(intslist.o)(.text+0x38a): In function `intl__strblist':
: undefined reference to `__ctype_b'

第1个回答  2007-06-27
在网上搜了些这方面的资料,有的说是linux系统内核和sybase版本的冲突,说是gcc2.**之前的版本可以,gcc3.**就会出现这样的错误,但查看了编译器是gcc2.96的,如何解决呢?

看到一帖:
创建linuxpatch.c源文件
#include <ctype.h>
__const unsigned short int *__ctype_b;
__const __int32_t *__ctype_tolower;
__const __int32_t *__ctype_toupper;
void ctSetup()
{
__ctype_b = *(__ctype_b_loc());
__ctype_toupper = *(__ctype_toupper_loc());
__ctype_tolower = *(__ctype_tolower_loc());
}
并在.c源程序中包含,并在main()中执行

按照这个加入了__ctype_b 部分,重新编译果然好使。

源帖出处:http://blog.chinaunix.net/u/28736/showart.php?id=240409

参考资料:http://blog.chinaunix.net/u/28736/showart.php?id=240409

本回答被提问者采纳