error: undefined reference to 'wcstombs'

developer 2014-05-21 06:10:12

E:/android-ndk-r9d/toolchains/arm-linux-androideabi-4.6/prebuilt/windows/bin/../lib/gcc/arm-linux-androideabi/4.6/../../../../arm-linux-androideabi/bin/ld.exe: jni/libfudx.a(FileBase.o): in function CUdxWchar::CpyFrom(wchar_t*):E:/FUdx_Android//jni/../jni/FastUdx/build/android/../../FileBase.h:88: error: undefined reference to 'wcstombs'


用的别人的.a 文件 我这里根本没有FileBase.h。

怎么处理啊..??
...全文
492 13 打赏 收藏 转发到动态 举报
写回复
用AI写文章
13 条回复
切换为时间正序
请发表友善的回复…
发表回复
Softwaring 2015-01-27
  • 打赏
  • 举报
回复
可以不用64位, 问题解决方法如下: http://blog.csdn.net/diaoying/article/details/43190765
Softwaring 2015-01-27
  • 打赏
  • 举报
回复
楼主在编译UDX吧? 换64位的? 貌似公司没有64位的机器。
developer 2014-07-07
  • 打赏
  • 举报
回复
引用 9 楼 Scorpion_0 的回复:
那是系统库 你换个系统就行了 你现在是32位系统就换64位系统 反之换32位
3q换了64位系统就可以了
linux_hsylar 2014-06-07
  • 打赏
  • 举报
回复
第三方库文件的编译生成方式可能和你自己编译生成函数名的xxxx.o的方式不一样,如你用的是C++编译器,对方使用的是C编译器,这会导致同一函数最终你生成的xxx.o函数名和对方库里面的函数名不一致,会导致错误; 你确定对方的xxx.o生成所用的编译器和你使用的编译器是同一类型么(同时是C或者C++编译器)?
A_nail 2014-06-06
  • 打赏
  • 举报
回复
那是系统库 你换个系统就行了 你现在是32位系统就换64位系统 反之换32位
developer 2014-05-22
  • 打赏
  • 举报
回复
引用 6 楼 u012936278 的回复:
makefile 里需要添加 LOCAL_LDLIBS ?? 添加什么?
是在编译filebase.o的时候filebase.h中产生的问题,所以我觉得加外部编译的library也不大管用,而且那个函数还是标准函数,也不知道怎么加library。我比较疑惑的是,.a是静态库,他的.o假定是只有编译成功才有.a文件的?还是编译失败也会产生.a文件,所以你的那个.a是有缺陷的?我没有用过库,所以不是很明白库怎么用的。我觉得你要是能有.cpp和.h把库重新编译下就好了,如果只有.o和.a,是不是没办法改变他内部的错误啊。。[/quote] 我只有.a
developer 2014-05-22
  • 打赏
  • 举报
回复
Android.mk


LOCAL_PATH := $(call my-dir)

#static预编译
include $(CLEAR_VARS) 
LOCAL_MODULE    := streamme
LOCAL_SRC_FILES := libStreamMediaLib.a
include $(PREBUILT_STATIC_LIBRARY)

include $(CLEAR_VARS) 
LOCAL_MODULE    := fudx
LOCAL_SRC_FILES := libfudx.a
include $(PREBUILT_STATIC_LIBRARY)

#dmc8_jni
include $(CLEAR_VARS)  

LOCAL_MODULE    := test

LOCAL_SRC_FILES := test.cpp 

LOCAL_STATIC_LIBRARIES := streamme	 fudx #引用静态库

LOCAL_LDLIBS += -llog 

include $(BUILD_SHARED_LIBRARY)

meiyou4 2014-05-22
  • 打赏
  • 举报
回复
makefile 里需要添加 LOCAL_LDLIBS ?? 添加什么?[/quote] 是在编译filebase.o的时候filebase.h中产生的问题,所以我觉得加外部编译的library也不大管用,而且那个函数还是标准函数,也不知道怎么加library。我比较疑惑的是,.a是静态库,他的.o假定是只有编译成功才有.a文件的?还是编译失败也会产生.a文件,所以你的那个.a是有缺陷的?我没有用过库,所以不是很明白库怎么用的。我觉得你要是能有.cpp和.h把库重新编译下就好了,如果只有.o和.a,是不是没办法改变他内部的错误啊。。
developer 2014-05-22
  • 打赏
  • 举报
回复
引用 3 楼 zhao4zhong1 的回复:
wcstombs Converts a sequence of wide characters to a corresponding sequence of multibyte characters. size_t wcstombs( char *mbstr, const wchar_t *wcstr, size_t count ); Routine Required Header Compatibility wcstombs <stdlib.h> ANSI, Win 95, Win NT
现在问题是一直提示找不到wcstombs 怎么做 才能让他编译过去....
developer 2014-05-22
  • 打赏
  • 举报
回复
引用 2 楼 u012936278 的回复:
我碰到过这样的问题,undefined reference to,我问题出现的状况最后查明是这样的,在makefile里编译的时候忘了添加新写的cpp,所以一直报错,就是因为没有找到这函数的申明和定义,还有一次是在几个cpp相互调来调去时,使用函数在申明函数之前了,它也报了这个错,所以大概就是没有准确的定义和调用。你没有那个h文件,会不会是那个.a文件自身就使用了那个h并且导致错误?我看那个wcstombs是标准库函数啊。。意见仅供参考哈。
makefile 里需要添加 LOCAL_LDLIBS ?? 添加什么?
赵4老师 2014-05-22
  • 打赏
  • 举报
回复
wcstombs Converts a sequence of wide characters to a corresponding sequence of multibyte characters. size_t wcstombs( char *mbstr, const wchar_t *wcstr, size_t count ); Routine Required Header Compatibility wcstombs <stdlib.h> ANSI, Win 95, Win NT For additional compatibility information, see Compatibility in the Introduction. Libraries LIBC.LIB Single thread static library, retail version LIBCMT.LIB Multithread static library, retail version MSVCRT.LIB Import library for MSVCRT.DLL, retail version Return Value If wcstombs successfully converts the multibyte string, it returns the number of bytes written into the multibyte output string, excluding the terminating NULL (if any). If the mbstr argument is NULL, wcstombs returns the required size of the destination string. If wcstombs encounters a wide character it cannot be convert to a multibyte character, it returns –1 cast to type size_t. Parameters mbstr The address of a sequence of multibyte characters wcstr The address of a sequence of wide characters count The maximum number of bytes that can be stored in the multibyte output string Remarks The wcstombs function converts the wide-character string pointed to by wcstr to the corresponding multibyte characters and stores the results in the mbstr array. The count parameter indicates the maximum number of bytes that can be stored in the multibyte output string (that is, the size of mbstr). In general, it is not known how many bytes will be required when converting a wide-character string. Some wide characters will require only one byte in the output string; others require two. If there are two bytes in the multibyte output string for every wide character in the input string (including the wide character NULL), the result is guaranteed to fit. If wcstombs encounters the wide-character null character (L'\0') either before or when count occurs, it converts it to an 8-bit 0 and stops. Thus, the multibyte character string at mbstr is null-terminated only if wcstombs encounters a wide-character null character during conversion. If the sequences pointed to by wcstr and mbstr overlap, the behavior of wcstombs is undefined. If the mbstr argument is NULL, wcstombs returns the required size of the destination string. Example /* WCSTOMBS.C illustrates the behavior of the wcstombs function. */ #include <stdio.h> #include <stdlib.h> void main( void ) { int i; char *pmbbuf = (char *)malloc( MB_CUR_MAX ); wchar_t *pwchello = L"Hello, world."; printf( "Convert wide-character string:\n" ); i = wcstombs( pmbbuf, pwchello, MB_CUR_MAX ); printf( "\tCharacters converted: %u\n", i ); printf( "\tMultibyte character: %s\n\n", pmbbuf ); } Output Convert wide-character string: Characters converted: 1 Multibyte character: H Data Conversion Routines | Locale Routines See Also mblen, mbstowcs, mbtowc, wctomb, WideCharToMultiByte
meiyou4 2014-05-22
  • 打赏
  • 举报
回复
我碰到过这样的问题,undefined reference to,我问题出现的状况最后查明是这样的,在makefile里编译的时候忘了添加新写的cpp,所以一直报错,就是因为没有找到这函数的申明和定义,还有一次是在几个cpp相互调来调去时,使用函数在申明函数之前了,它也报了这个错,所以大概就是没有准确的定义和调用。你没有那个h文件,会不会是那个.a文件自身就使用了那个h并且导致错误?我看那个wcstombs是标准库函数啊。。意见仅供参考哈。
developer 2014-05-22
  • 打赏
  • 举报
回复
没人回复????????

64,654

社区成员

发帖
与我相关
我的任务
社区描述
C++ 语言相关问题讨论,技术干货分享,前沿动态等
c++ 技术论坛(原bbs)
社区管理员
  • C++ 语言社区
  • encoderlee
  • paschen
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
  1. 请不要发布与C++技术无关的贴子
  2. 请不要发布与技术无关的招聘、广告的帖子
  3. 请尽可能的描述清楚你的问题,如果涉及到代码请尽可能的格式化一下

试试用AI创作助手写篇文章吧