文章目錄
- 1 、調試功能
- 2 、 編譯中的常見錯誤例析
- 3 、常見錯誤資訊語句索引
1 、調試功能
1.常用健
<F10> : 激活系統菜單
<F6> : 将光标在編輯視窗和、資訊視窗之間切換
<F3> : 加載<load>一個檔案
<Alt>+<F5> : 檢視程式運作結果
<F1> : 得到有關編輯器線上幫助
<Ctrl>+<F1> : 得到有關C語言的線上幫助
<Ctrl>+<Break> : 終止正在運作的程式
2.塊操作
<Ctrl> KB: 定義塊首
<Ctrl> KK: 定義塊尾
<Ctrl> KV: 塊移動
<Ctrl> KC: 塊複制
<Ctrl> KY: 塊删除
<Ctrl> KH: 取消塊定義
3.查找、替換和删除操作
<Ctrl> QF: 查找字元串
<Ctrl> QA: 查找并替換字元串
Option: G(全程), B(向檔案頭), N(直接替換)
<Ctrl> Y : 删除一行
<Ctrl> QY: 删除從光标位置到行末的所有字元
2 、 編譯中的常見錯誤例析
(1) 警告類錯誤
1 、‘XXX’declare but never used 變量XXX已定義但從未用過。
2 、‘XXX’is assigned a value which is never used 變量XXX已指派但從未用過。
3 、 Code has no effect 程式中含有沒有實際作用的代碼。
4 、Non-portable pointer conversion 不适當的指針轉換,可能是在應該使用指針的地方用了一個非0的數值。
5、 Possible use of ‘XXX’before definition 表達式中使用了未指派的變量
6、 Redeclaration of ‘main’ 一個程式檔案中主函數main不止一個。
7、 Suspicious pointer conversion 可疑的指針轉換。通常是使用了基本類型不比對的指針。
8、 Unreachable code 程式含有不能執行到的代碼。
(2) 錯誤或緻命錯誤
1、Compound statement missing } in function main 程式結尾缺少括号}。
2、“}”expected; “(”expected等 複合語句或數組初始化的結尾缺少“)”;“(”。
3、 Case outside of switch case 不屬于Switch結構,多由于switch結構中的花括号不配對所緻。
4、 Case statement missing ‘:’ switch結構中的某個case之後缺少冒号。
5、 Constant expression required 定義數組時指定的數組長度不是常量表達式。
6、 Declaration syntax error 結構體或聯合類型的定義後缺少分号。
7、 Declaration was expected 缺少說明,通常是因為缺少分界符如逗号、分号、右圓括号等所引起的。
8、 Default outside switch Default部分放到了switch結構之外,一般是因為花括号不比對而引起的。
9、do statement must have while do語句中缺少相應的while部分。
10、Expression syntax 表達式文法錯。如表達式中含有兩個連續的運算符
11、 Extra parameter in call ‘fun’ 調用函數fun時給出了多餘的實參。
12、 Function should return a value 函數應該傳回一個值,否則與定義時的說明類型不比對。
13、 Illegal use of pointer 指針被非法引用,一般是使用了非法的指針運算。
14、 Invalid pointer addition 指針相加非法。一個指針(位址)可以和一個整數相加,但兩個指針不能相加。
15、 Lvalue required 指派運算的左邊是不能尋址的表達式。
16、 Misplaced else 程式遇到了沒有配對的else
17、 No matching 表達式中的括号不配對。
18、 Pointer required on left side of_> 在“_>”運算的左邊隻能允許一個指針而不能是一個一般的結構體變量或聯合類型的變量。
19、 Statement missing; 程式遇到了後面沒有分号的語句。
20、 Too few parameters in call 調用某個函數時實參數目不夠。
21、 Unable to open include file ‘XXXXXXXX.XXX’ 頭檔案找不到。
22、 Unexpected }或:或{ 在不希望的地方使用了}或:{。
23 、 Undefined symbol ‘X’in function fun 函數fun中的變量X沒有定義。
5.連接配接中的常見錯誤
主要錯誤類似于“undefined symbol _print in modula xxx”(print沒有定義),通常是函數名書寫錯誤。
6.運作中的常見錯誤
1、Abnormal program termination 程式異常終止。通常是由于記憶體使用不當所緻。
2、Floating point error : Domain 或Divide by 0 運算結果不是一個數或被0 除
3、Null pointer assignment 對未初始化的指針指派,程式有嚴重錯誤。
4、User break 在運作程式時終止。
(1) GO to Cursor (<F4>)——選擇該選項使程式執行到光标所在行
首先将光标移到某行(一般為可執行),選擇該功能項,則程式執行到該行的前一行暫停。此時程式處于跟蹤調試狀态,并有亮條顯示在暫停處,此時可以查詢變量或表達式的值。
(2) Trace into (<F7>)——執行一條語句或一行暫停
此時程式處于跟蹤調試狀态,并有亮條顯示在暫停處。該選項可跟蹤到被調函數的内部。
(3) Step over (<F8>)——執行一條語句或一行暫停
此時程式處于跟蹤調試狀态,并有亮條顯示在暫停處。該選項将自定義函數當作一個語句執行,不跟蹤到函程式的内部。
(4) Debug 菜單
程式處于跟蹤狀态時,可使用該菜單的選項。
其主要是使用Evaluate——目的是查詢或更新變量或表達式的值。
選擇Evaluate功能後,系統彈出一個對話框。該對話框包含三個選項區域:Evaluate域可以輸入一個含有目前代碼中(程式暫停區的作用域)正在使用的變量名、或含變量的表達式、或常量表達式。按Enter鍵後,在Result域中顯示變量或表達式的值。還可以用New value域進行調試。
如果調試程式時發現Result域顯示的某變量或表達式的值不正确,并能估計出該變量或表達式的值,則可以将該值輸入到New value域,繼續執行程式,其目的是肯定錯誤發生處是否在目前位置之前。如果輸入這個正确的值并将程式繼續執行完畢而結果正确,說明在目前暫停處之前已經發生錯誤而之後無錯誤。
(5) Break/Watch——用于設定斷點和監視表達式。
選擇Add Watch功能選項,系統将彈出一個菜單,在Add Watch框中輸入變量名或表達式,按Enter鍵後,系統在螢幕底部開辟一個視窗并顯示 該變量或表達式的值。
3 、常見錯誤資訊語句索引
Ambiguous operators need parentheses:不明确的運算需要用括号括起
Ambiguous symbol 'xxx' :不明确的符号
Argument list syntax error:參數表文法錯誤
Array bounds missing ] in function main 缺少數組界限符 "]"
Array bounds missing :丢失數組界限符
Array size too large :數組尺寸太大
Bad character in paramenters :參數中有不适當的字元
Bad file name format in include directive :包含指令中檔案名格式不正确
Bad ifdef directive synatax :編譯預處理ifdef有文法錯
Bad undef directive syntax :編譯預處理undef有文法錯
Bit field too large :位字段太長
Call of non-function :調用未定義的函數
Call to function with no prototype :調用函數時沒有函數的說明
Cannot modify a const object :不允許修改常量對象
Case outside of switch :漏掉了case 語句
Case syntax error :Case 文法錯誤
Code has no effect :代碼不可述不可能執行到
Compound statement missing{ :分程式漏掉"{"
Conflicting type modifiers :不明确的類型說明符
Constant expression required :要求常量表達式
Constant out of range in comparison :在比較中常量超出範圍
Conversion may lose significant digits :轉換時會丢失意義的數字
Conversion of near pointer not allowed :不允許轉換近指針
Could not find file 'xxx' :找不到XXX檔案
Declaration missing ; :說明缺少";"
Declaration syntax error :說明中出現文法錯誤
Default outside of switch :Default 出現在switch語句之外
Define directive needs an identifier :定義編譯預處理需要辨別符
Division by zero :用零作除數
Do statement must have while :Do-while語句中缺少while部分
Enum syntax error :枚舉類型文法錯誤
Enumeration constant syntax error :枚舉常數文法錯誤
Error directive :xxx :錯誤的編譯預處理指令
Error writing output file :寫輸出檔案錯誤
Expression syntax error :表達式文法錯誤
Extra parameter in call :調用時出現多餘錯誤
File name too long :檔案名太長
Function call missing ) :函數調用缺少右括号
Fuction definition out of place :函數定義位置錯誤
Fuction should return a value :函數必需傳回一個值
Goto statement missing label :Goto語句沒有标号
Hexadecimal or octal constant too large :16進制或8進制常數太大
Illegal character 'x' :非法字元x
Illegal initialization :非法的初始化
Illegal octal digit :非法的8進制數字
Illegal pointer subtraction :非法的指針相減
Illegal structure operation :非法的結構體操作
Illegal use of floating point :非法的浮點運算
Illegal use of pointer :指針使用非法
Improper use of a typedefsymbol :類型定義符号使用不恰當
In-line assembly not allowed :不允許使用行間彙編
Incompatible storage class :存儲類别不相容
Incompatible type conversion :不相容的類型轉換
Incorrect number format :錯誤的資料格式
Incorrect use of default
Default使用不當
Invalid indirection 無效的間接運算
Invalid pointer addition 指針相加無效
Irreducible expression tree 無法執行的表達式運算
Lvalue required 需要邏輯值0或非0值
Macro argument syntax error 宏參數文法錯誤
Macro expansion too long 宏的擴充以後太長
Mismatched number of parameters in definition 定義中參數個數不比對
Misplaced break 此處不應出現break語句
Misplaced continue 此處不應出現continue語句
Misplaced decimal point 此處不應出現小數點
Misplaced elif directive 不應編譯預處理elif
Misplaced else 此處不應出現else
Misplaced else directive 此處不應出現編譯預處理else
Misplaced endif directive 此處不應出現編譯預處理endif
Must be addressable 必須是可以編址的
Must take address of memory location 必須存儲定位的位址
No declaration for function 'xxx' 沒有函數xxx的說明
No stack 缺少堆棧
No type information 沒有類型資訊
Non-portable pointer assignment 不可移動的指針(位址常數)指派
Non-portable pointer comparison 不可移動的指針(位址常數)比較
Non-portable pointer conversion 不可移動的指針(位址常數)轉換
Not a valid expression format type 不合法的表達式格式
Not an allowed type 不允許使用的類型
Numeric constant too large 數值常太大
Out of memory 記憶體不夠用
Parameter 'xxx' is never used 能數xxx沒有用到
Pointer required on left side of -> 符号->的左邊必須是指針
Possible use of 'xxx' before definition 在定義之前就使用了xxx(警告)
Possibly incorrect assignment 指派可能不正确
Redeclaration of 'xxx' 重複定義了xxx
Redefinition of 'xxx' is not identical xx的兩次定義不一緻
Register allocation failure 寄存器定址失敗
Repeat count needs an lvalue 重複計數需要邏輯值
Size of structure or array not known 結構體或數給大小不确定
Statement missing ; 語句後缺少";"
Structure or union syntax error X構體或聯合體文法錯誤
Structure size too large 結構體尺寸太大
Sub scripting missing ] 下标缺少右方括号
Superfluous & with function or array 函數或數組中有多餘的"&"
Suspicious pointer conversion 可疑的指針轉換
Symbol limit exceeded 符号超限
Too few parameters in call 函數調用時的實參少于函數的參數不
Too many default cases Default太多(switch語句中一個)
Too many error or warning messages 錯誤或警告資訊太多
Too many type in declaration 說明中類型太多
Too much auto memory in function 函數用到的局部存儲太多
Too much global data defined in file 檔案中全局資料太多
Two consecutive dots 兩個連續的句點
Type mismatch in parameter xxx 數xxx類型不比對
Type mismatch in redeclaration of 'xxx' xx重定義的類型不比對
Unable to create output file 'xxx' 無法建立輸出檔案xxx
Unable to open include file 'xxx' 無法打開被包含的檔案xxx
Unable to open input file 'xxx' 無法打開輸入檔案xxx
Undefined label 'xxx' 沒有定義的标号xxx
Undefined structure 'xxx' 沒有定義的結構xxx
Undefined symbol 'xxx' 沒有定義的符号xxx
Unexpected end of file in comment started on line xxx 從xxx行開始的注解尚未結束檔案不能結束
Unexpected end of file in conditional started on line xxx 從xxx 開始的條件語句尚未結束檔案不能結束
Unknown assemble instruction 未知的彙編結構
Unknown option 未知的操作
Unknown preprocessor directive: 'xxx' 不認識的預處理指令xxx
Unreachable code 無路可達的代碼
Unterminated string or character constant 字元串缺少引号
User break 使用者強行中斷了程式
Void functions may not return a value Void類型的函數不應有傳回值
Wrong number of arguments 調用函數的參數數目錯
'xxx' not an argument xxx不是參數
'xxx' not part of structure xxx不是結構體的一部分
xxx statement missing ( xxx語句缺少左括号
xxx statement missing ) xxx語句缺少右括号
xxx statement missing ; xxx缺少分号
'xxx' declared but never used 說明了xxx但沒有使用
'xxx' is assigned a value which is never used 給xxx賦了值但未用過
Zero length structure 結構體的長度為零