0

来自重新编译 libiconv 的片段,gettext undefined symbols 在已经成功安装后发生;想把它作为自己的问题。

尝试libiconv在一个简单的.c文件中使用:

#include <iconv.h>
// works: gcc -m32 -I/usr/local/include -liconv -o test-iconv.exe test-iconv.c
// does NOT work: gcc -I/usr/local/include -liconv -o test-iconv.exe test-iconv.c
int main(int argc, char **argv) {
    iconv_t conv = iconv_open("ISO8859-1", "UTF-8");
    if (conv != (iconv_t) -1) {
    return 0;
    }
    return 1;
}

如果我没有指定-m32gcc那么我收到以下错误:

$ gcc -I/usr/local/include -liconv -o test-iconv.exe test-iconv.c
Undefined symbols for architecture x86_64:
  "_libiconv_open", referenced from:
      _main in ccr9tTic.o
ld: symbol(s) not found for architecture x86_64
collect2: ld returned 1 exit status
4

1 回答 1

0
于 2017-05-26T17:38:30.330 回答