程式設計常見錯誤總結

2021-08-19 01:40:36 字數 3044 閱讀 7656

1):program terminated with signal 6, aborted.

棧溢位問題報錯

no symbol table is loaded.  use the

"file"

command.

aborted (core dumped)

(gdb) where

#00x0000003aaa232925

in?? ()

#10x0000003aaa234105

in?? ()

#20x00007fff7b621418

in?? ()

#30x00007fff7b621400

in?? ()

#40x00007fff7b622875

in?? ()

#50x000000000000000b

in?? ()

#60x0000003aaa3578cf

in?? ()

#70x0000000000000003

in?? ()

#80x00007fff7b62140a

in?? ()

#90x0000000000000006

in?? ()

#100x0000003aaa3578d3

in?? ()

#110x0000000000000002

in?? ()

#120x00007fff7b6213fe

in?? ()

#130x0000000000000002

in?? ()

#140x0000003aaa355e84

in?? ()

#150x0000000000000001

in?? ()

#160x0000003aaa3578cf

in?? ()

#170x0000000000000003

in?? ()

#180x00007fff7b621406

in?? ()

#190x000000000000000a

in?? ()

---type

<

return

>

to continue, or q <

return

>

to quit---

2)標頭檔案未加#,產生錯誤如下

string

constant

heap.c:10: error: expected 『)』 before 『a』

heap.c:15: error: expected 『)』 before 『*』 token

heap.c:30: error: expected identifier or 『(』 before 『if』

make: *** [heap] error 1

3)警告:賦值從指標中生成整數。

源**

void swap(heaptype* a,heaptype* b)

heap.c:47: warning: assignment makes integer

from pointer without

a cast

4)error:two or more data types in declaration specifiers

error:two or more data types in declaration specifiers

原因可能有兩個:

少了乙個分號」;」,比如定義乙個結構體時,在最後忘了加分號。

解決方法:加上分號即可。

重複定義,比如:a.h檔案中有如下定義:

error:two or more data types in declaration specifiers

error:two

or more data types in declaration specifiers

原因可能有兩個:

1. 少了乙個分號";",比如定義乙個結構體時,在最後忘了加分號。

解決方法:加上分號即可。

2. 重複定義,比如:a.h檔案中有如下定義:

error:two or more data types in declaration specifiers

error:two or more data types in declaration specifiers

原因可能有兩個:

1. 少了乙個分號";",比如定義乙個結構體時,在最後忘了加分號。

解決方法:加上分號即可。

2. 重複定義,比如:a.h檔案中有如下定義:

#define bool

char

#define bool

char

b.h檔案中有如下定義:

typedefcharbool;

typedef char

bool;

然後在main.c中同時包含a.h和b.h:

#include

"a.h"

#include

"b.h"

5)

server.c:113: error: expected 『)』 before 『;』 token

server.c:113: error: too few arguments to

function 『select』

問題出現的地方:(函式中把,寫成了;)

int ret=select(max_fd+1 ; &read_fds,null,null,null)
改正後

int ret=select(max_fd+1,&read_fds,null,null,null)

程式設計常見錯誤

1.在寫類的成員函式的時候,忘記在成員函式前寫類名字,導致類中的資料成員不可見,報錯 qvector3d calfacenormal const int f0,const int f1,const int f2,qvector3d facenormal 上面這麼寫會導致normals不可見,報錯為 ...

常見錯誤總結

1.呼叫函式中使用的變數名與主函式中一致,沒有影響 include int isfullsquare int n int main 2.浮點數在賦值和計算中忘記加.0 3.忘記將布林變數 計數器變數 累加變數初始化為0 忘記將累乘變數初始化為1 注意初始化位置在迴圈內外的差別,對於多組資料的輸入應將...

常見錯誤總結

博主今天因為debug text debug 的事被教訓罵了所以記錄一下在debug text debug 的過程中都發現了什麼智障錯誤 取mod text mod的時候注意輸入也可能超出範圍,最好在輸入的時候取一下模。對於某些sb題請在讀入優化那個函式裡也取模 noip2014解方程 取模最好用函...