-1
#include <libyahoo2/yahoo2.h>
#include <libyahoo2/yahoo2_callbacks.h>
#include <yahoo2.h>
#include <stdlib.h>
#include <string.h>
#include <stdio.h>

int main() {
    int id ;
    char username[255] = "slam";
    char password[255] = "ss" ;
    id = yahoo_init(username, password);
    enum yahoo_status mYahoo ;
    mYahoo = YAHOO_STATUS_AVAILABLE ;
    yahoo_login(id , mYahoo );

    return 0;
}

大家好,当我编译这段代码时,输​​出是分段错误任何机构都可以帮助我解决它

4

2 回答 2

0

错误是这个分段错误(核心转储)

您需要学习如何诊断此类问题。

由于您使用的是某种 UNIX 系统(您最好指定将来使用的系统),因此进行此类诊断的工具称为调试器。

在 Linux 和许多其他操作系统上,调试器称为gdb.

所以你跑

gdb /path/to/your/executable
(gdb) run
# GDB will stop at crash point
(gdb) where   # <<== this command will tell you where your crash is happening

一旦你知道程序在哪里崩溃,你就可以提出更好的问题。

于 2013-07-03T03:29:09.823 回答
0

tnx 的帮助

程序收到信号 SIGSEGV,分段错误。0xb7fac9b1 in yahoo_login (id=1, initial=0) at libyahoo2.c:1735 1735 libyahoo2.c: 没有这样的文件或目录。在 libyahoo2.c 中

(gdb) 在哪里

0 0xb7fac9b1 在 yahoo_login (id=1, initial=0) 在 libyahoo2.c:1735

1 0x080486a0 in main () at bc:20

(gdb)

于 2013-07-03T09:09:13.793 回答