在AIX上编译C程序时出错-“ ld:0711-317错误:未定义符号:.iconv_open”

时间:2019-11-04 09:53:25

标签: c aix iconv

我在代码中使用iconv_open()函数,但是在使用cc编译代码时却出错了

  

“ ld:0711-317错误:未定义的符号:.iconv_open”

这是我要编译的c代码

#include<stdio.h>
#include<iconv.h>

#define CONV_FAILED  ((iconv_t) -1)

int main(){
iconv_t some;
some = iconv_open("eucKR", "UTF-8");

if (some != CONV_FAILED){
        printf("%s \n", "something else");
        }
else    {
        printf("%s \n","error occurred");
        }
}

错误消息:

  

bash-2.05a $ cc iconv.c ld:0711-317错误:未定义的符号:   .iconv_open ld:0711-345使用-bloadmap或-bnoquiet选项可以   获取更多信息。

我还使用了-bloadmap,这是使用它生成的文件内容

(ld): halt 4
(ld): setfflag 4
(ld): savename a.out
(ld): filelist 6 1
(ld): i /lib/crt0.o
(ld): i iconv.o
(ld): lib /usr/vac/lib/libxlopt.a
(ld): lib /usr/vac/lib/libxlipa.a
(ld): lib /usr/vac/lib/libxl.a
(ld): lib /usr/lib/libc.a
LIBRARY: Shared object libc.a[shr.o]: 3243 symbols imported.
LIBRARY: Shared object libc.a[meth.o]: 2 symbols imported.
LIBRARY: Shared object libc.a[posix_aio.o]: 20 symbols imported.
LIBRARY: Shared object libc.a[aio.o]: 18 symbols imported.
LIBRARY: Shared object libc.a[pse.o]: 8 symbols imported.
LIBRARY: Shared object libc.a[dl.o]: 4 symbols imported.
LIBRARY: Shared object libc.a[pty.o]: 1 symbols imported.
FILELIST: Number of previously inserted files processed: 6
(ld): resolve
RESOLVE: 34 of 6664 symbols were kept.
(ld): addgl /usr/lib/glink.o
ADDGL: Glink code added for 3 symbols.
(ld): er full
ld: 0711-318 ERROR: Undefined symbols were found.
        The following symbols are in error:
 Symbol                    Inpndx  TY CL Source-File(Object-File) OR Import-File{Shared-object}
                              RLD: Address  Section  Rld-type Referencing Symbol
 ----------------------------------------------------------------------------------------------
 .iconv_open               [24]    ER PR iconv.c(iconv.o)
                                   0000001c .text    R_RBR    [12]    .main
ER: The return code is 8.

我想知道为什么会产生此错误,请多加注意。

0 个答案:

没有答案