0

伙计们,我遇到了一个对我来说真的很痛苦的问题

我得到了几行代码,在编译这些代码时显示了一些错误

在编译时

$ gcc `pkg-config --cflags glib-2.0` main.c -lssl

输出

/tmp/ccQ7vAnA.o: In function `yahoo_ping_timeout_callback':
main.c:(.text+0x4ca): undefined reference to `yahoo_keepalive'
/tmp/ccQ7vAnA.o: In function `yahoo_webcam_timeout_callback':
main.c:(.text+0x6bd): undefined reference to `yahoo_webcam_send_image'
/tmp/ccQ7vAnA.o: In function `ext_yahoo_got_conf_invite':
main.c:(.text+0x86f): undefined reference to `y_list_append'
/tmp/ccQ7vAnA.o: In function `ext_yahoo_conf_userdecline':
main.c:(.text+0x96d): undefined reference to `y_list_remove_link'
main.c:(.text+0x97e): undefined reference to `y_list_free_1'
/tmp/ccQ7vAnA.o: In function `ext_yahoo_conf_userjoin':
main.c:(.text+0xa54): undefined reference to `y_list_append'
/tmp/ccQ7vAnA.o: In function `ext_yahoo_conf_userleave':
main.c:(.text+0xb17): undefined reference to `y_list_remove_link'
main.c:(.text+0xb28): undefined reference to `y_list_free_1'
/tmp/ccQ7vAnA.o: In function `ext_yahoo_conf_message':
main.c:(.text+0xb85): undefined reference to `y_utf8_to_str'
/tmp/ccQ7vAnA.o: In function `ext_yahoo_chat_room_received':
main.c:(.text+0x135d): undefined reference to `yahoo_get_chat_room_list'
/tmp/ccQ7vAnA.o: In function `ext_yahoo_chat_message':
main.c:(.text+0x15c7): undefined reference to `y_utf8_to_str'
/tmp/ccQ7vAnA.o: In function `ext_yahoo_got_buddies':
main.c:(.text+0x1acc): undefined reference to `y_list_append'
/tmp/ccQ7vAnA.o: In function `ext_yahoo_got_im':
main.c:(.text+0x1caa): undefined reference to `y_utf8_to_str'
/tmp/ccQ7vAnA.o: In function `ext_yahoo_webcam_viewer':
main.c:(.text+0x22cc): undefined reference to `yahoo_webcam_accept_viewer'
/tmp/ccQ7vAnA.o: In function `yahoo_logout':
main.c:(.text+0x2528): undefined reference to `yahoo_conference_logoff'
main.c:(.text+0x265e): undefined reference to `yahoo_logoff'
main.c:(.text+0x2671): undefined reference to `yahoo_close'
/tmp/ccQ7vAnA.o: In function `ext_yahoo_login':
main.c:(.text+0x273c): undefined reference to `yahoo_init_with_attributes'
main.c:(.text+0x276a): undefined reference to `yahoo_login'
/tmp/ccQ7vAnA.o: In function `ext_yahoo_login_response':
main.c:(.text+0x27ba): undefined reference to `yahoo_current_status'
/tmp/ccQ7vAnA.o: In function `yahoo_set_current_state':
main.c:(.text+0x2b5a): undefined reference to `yahoo_set_away'
main.c:(.text+0x2b86): undefined reference to `yahoo_set_away'
main.c:(.text+0x2bb2): undefined reference to `yahoo_set_away'
/tmp/ccQ7vAnA.o: In function `ext_yahoo_add_handler':
main.c:(.text+0x2ccb): undefined reference to `y_list_prepend'
/tmp/ccQ7vAnA.o: In function `yahoo_callback':
main.c:(.text+0x3082): undefined reference to `yahoo_read_ready'
main.c:(.text+0x30c5): undefined reference to `yahoo_write_ready'
/tmp/ccQ7vAnA.o: In function `process_commands':
main.c:(.text+0x37b1): undefined reference to `yahoo_send_im'
main.c:(.text+0x37c1): undefined reference to `y_str_to_utf8'
main.c:(.text+0x37fd): undefined reference to `yahoo_send_im'
main.c:(.text+0x390d): undefined reference to `yahoo_conference_message'
main.c:(.text+0x3ad4): undefined reference to `y_list_append'
main.c:(.text+0x3b1e): undefined reference to `y_list_append'
main.c:(.text+0x3b87): undefined reference to `y_list_append'
main.c:(.text+0x3bc3): undefined reference to `yahoo_conference_invite'
main.c:(.text+0x3be4): undefined reference to `y_list_append'
main.c:(.text+0x3c42): undefined reference to `y_list_append'
main.c:(.text+0x3cb7): undefined reference to `y_list_free'
main.c:(.text+0x3d08): undefined reference to `yahoo_conference_addinvite'
main.c:(.text+0x3d27): undefined reference to `y_list_append'
main.c:(.text+0x3d46): undefined reference to `y_list_free'
main.c:(.text+0x3e2c): undefined reference to `y_list_append'
main.c:(.text+0x3e5e): undefined reference to `yahoo_conference_logon'
main.c:(.text+0x3f02): undefined reference to `yahoo_conference_logoff'
main.c:(.text+0x3f16): undefined reference to `y_list_remove'
main.c:(.text+0x40d6): undefined reference to `yahoo_conference_decline'
main.c:(.text+0x40ea): undefined reference to `y_list_remove'
main.c:(.text+0x420b): undefined reference to `yahoo_get_chatrooms'
main.c:(.text+0x4265): undefined reference to `yahoo_get_chat_room_list'
main.c:(.text+0x4383): undefined reference to `yahoo_chat_logon'
main.c:(.text+0x4441): undefined reference to `yahoo_chat_message'
main.c:(.text+0x449b): undefined reference to `yahoo_chat_ignore'
main.c:(.text+0x44f5): undefined reference to `yahoo_chat_ignore'
main.c:(.text+0x4534): undefined reference to `yahoo_chat_logoff'
main.c:(.text+0x4600): undefined reference to `yahoo_set_away'
main.c:(.text+0x4671): undefined reference to `yahoo_get_identities'
main.c:(.text+0x470b): undefined reference to `yahoo_set_identity_status'
main.c:(.text+0x4751): undefined reference to `yahoo_set_identity_status'
main.c:(.text+0x4973): undefined reference to `yahoo_set_yab'
main.c:(.text+0x49fa): undefined reference to `yahoo_webcam_get_feed'
main.c:(.text+0x4a30): undefined reference to `yahoo_webcam_get_feed'
main.c:(.text+0x4a7f): undefined reference to `yahoo_webcam_invite'
/tmp/ccQ7vAnA.o: In function `main':
main.c:(.text+0x4dc0): undefined reference to `yahoo_set_log_level'
main.c:(.text+0x4f44): undefined reference to `y_list_remove_link'
main.c:(.text+0x4f58): undefined reference to `y_list_free_1'
main.c:(.text+0x534e): undefined reference to `y_list_remove_link'
main.c:(.text+0x5362): undefined reference to `y_list_free_1'
/tmp/ccQ7vAnA.o: In function `register_callbacks':
main.c:(.text+0x589a): undefined reference to `yahoo_register_callbacks'
collect2: ld returned 1 exit status

无论如何,我从文件夹中包含了库的标题,而不是来自共享库,

#include "yao/yahoo2.h"
#include "yao/yahoo2_callbacks.h"
#include "yao/yahoo_util.h"

而且我相信,我编译代码的方式是非常错误的,我对此一无所知。好吧,有人介意让我摆脱这些痛苦吗?

真的提前谢谢

来源

http://pastebin.com/TBetQxpF

关于在stackoverflow上发布char的限制,我已经将它粘贴在pastebin上,我希望这些可以让你更容易理解我在说什么..

4

1 回答 1

1

尝试添加-lyahoo2您的 gcc 行。

编辑:看来你应该自己实现 ext_* 函数。

来自libyahoo2 - 自述文件

“yahoo2_callbacks.h 包含您必须 实现的功能的原型。 所有这些功能都必须由您的代码实现。”

Edit2:尝试在 main() 函数的最开始添加对 register_callbacks() 函数的调用。

于 2011-06-07T16:13:30.637 回答