gpt4 book ai didi

在 OS X 下编译 libmms

转载 作者:行者123 更新时间:2023-11-30 18:03:34 25 4
gpt4 key购买 nike

我在 C 语言中的一些非常基本的静态库链接方面遇到了麻烦。该库是 libMMS 0.6.2,并且该程序非常简单。 libmms.a 和 test.c 位于同一文件夹中,头文件位于 ./libmms 下。 OS X Lion下编译器为llvm-gcc-4.2。

编译libmms:

CFLAGS="-march=x86_64" ./configure
make

测试.c:

#include <stdio.h>
#include "libmms/mms.h"

int main(void)
{
mms_t *mms = mms_connect(NULL, NULL, "mms://some.url.com", 128*1024);
return 0;
}

编译程序:

gcc -o test test.c libmms.a

这给了我一长串 undefined symbol

Undefined symbols for architecture x86_64:
"_libiconv", referenced from:
_string_utf16 in libmms.a(mms.o)
"_libiconv_open", referenced from:
_mms_connect in libmms.a(mms.o)
"_libiconv_close", referenced from:
_mms_connect in libmms.a(mms.o)
"_g_strdup", referenced from:
_split_user_passwd in libmms.a(uri.o)
_gnet_uri_new in libmms.a(uri.o)
_gnet_uri_new_fields in libmms.a(uri.o)
_gnet_uri_new_fields_all in libmms.a(uri.o)
_gnet_uri_clone in libmms.a(uri.o)
_gnet_uri_set_scheme in libmms.a(uri.o)
_gnet_uri_set_userinfo in libmms.a(uri.o)
...
"_g_free", referenced from:
_split_user_passwd in libmms.a(uri.o)
_gnet_uri_new in libmms.a(uri.o)
_gnet_uri_delete in libmms.a(uri.o)
_field_escape in libmms.a(uri.o)
_gnet_uri_set_scheme in libmms.a(uri.o)
_gnet_uri_set_userinfo in libmms.a(uri.o)
_gnet_uri_set_hostname in libmms.a(uri.o)
...
"_g_return_if_fail_warning", referenced from:
_gnet_uri_new in libmms.a(uri.o)
_gnet_uri_clone in libmms.a(uri.o)
_gnet_uri_equal in libmms.a(uri.o)
_gnet_uri_hash in libmms.a(uri.o)
_gnet_uri_escape in libmms.a(uri.o)
_gnet_uri_unescape in libmms.a(uri.o)
_gnet_uri_get_string in libmms.a(uri.o)
...
"_g_malloc0_n", referenced from:
_gnet_uri_new in libmms.a(uri.o)
_gnet_uri_new_fields in libmms.a(uri.o)
_gnet_uri_new_fields_all in libmms.a(uri.o)
_gnet_uri_clone in libmms.a(uri.o)
"_g_strndup", referenced from:
_gnet_uri_new in libmms.a(uri.o)
"_g_str_hash", referenced from:
_gnet_uri_hash in libmms.a(uri.o)
"_g_malloc", referenced from:
_field_escape in libmms.a(uri.o)
"_g_string_sized_new", referenced from:
_gnet_uri_get_string in libmms.a(uri.o)
"_g_string_append_printf", referenced from:
_gnet_uri_get_string in libmms.a(uri.o)
"_g_string_append", referenced from:
_gnet_uri_get_string in libmms.a(uri.o)
"_g_string_free", referenced from:
_gnet_uri_get_string in libmms.a(uri.o)
"_g_string_insert_c", referenced from:
_g_string_append_c_inline in libmms.a(uri.o)
ld: symbol(s) not found for architecture x86_64
collect2: ld returned 1 exit status

我在这里错过了一些简单的东西吗?

最佳答案

似乎 libmms 依赖于 libiconvglib,因此您还需要链接它们。

关于在 OS X 下编译 libmms,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8275111/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com