c常见错误
///Segmentation fault
段錯誤
可能有未初始化的變量
導致段錯誤的幾種情況
1、 引用一個包含非法值的指針(當然包括空指針)。
2、 未得到正確的權限的時候進行訪問,例如往只讀的內存地址寫數據。
3、 內存越界(數組越界,變量類型不一致等)
///error: too few arguments to function ‘sleep
函數sleep參數過少。
///undefined reference to `pthread_create'
對‘pthread_create’未定義的引用。
由于pthread庫不是Linux系統默認的庫,連接時需要使用庫libpthread.a,所以在使用pthread_create創建線程時,在編譯中要加-lpthread參數
///error: unterminated #ifndef
缺少#endif
///執行用戶程序就出現段錯誤
解決方法:編譯的應用程序加擴展名.out
///conflicting types for 'pass'
類型沖突
///incompatible implicit declaration of built-in function
不兼容的隱式聲明與內建函數
總結
- 上一篇: 【工具使用】Modsim32软件使用详解
- 下一篇: 入驻支付宝开放平台并创建应用的基本流程