2013-07-02 81 views
-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; 
} 

大家好,当我编译这段代码的出放为分段故障 任何机构可以帮我解决这个问题PLZ分段错误

+0

分段错误在哪里?它应该告诉你问题出现在哪里... –

+0

我不知道。错误是这个Segmentation fault(核心转储) –

+0

[libyahoo Segmentation fault]的可能重复(http://stackoverflow.com/questions/9203461/libyahoo-segmentation-fault) –

回答

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 

一旦你知道程序崩溃,你就可以问更好的问题。

0

tnx帮助

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

(GDB)其中

0 0xb7fac9b1在yahoo_login在libyahoo2.c(ID = 1,初始= 0):在公元前1735

1在主0x080486a0():20

(gdb)