2013-07-02 176 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)