C++語言常見錯誤分析匯總

在一個工程里出現兩個main函數時

3.obj : error LNK2005: _main already defined in file1.obj

Debug/HELLO.exe : fatal error LNK1169: one or more multiply defined symbols found

這個就是說,你的main函數重定義了。你看看是不是你的工程里面,包含了很多個有main函數的文件?

fatal error C1010: unexpected end of file while looking for precompiled header directive

出現這個錯誤的原因是,工程類型建錯了,應該選擇win 32 console application

提示錯誤:

error C2065: 'A' : undeclared identifier

書寫標識符時,忽略了大小寫字母的區別。

如:

main()

{

int a=5;

cout<<A;

}

error syntax error : missing ';' before identifier 'b'

語法錯誤:標識符b之前缺少分號

LINK : fatal error LNK1168: cannot open Debug/P1.exe for writing

連接錯誤:不能打開P1.exe文件,以改寫內容。一般是P1.Exe還在運行,未關閉,關閉運行界面即可

warning C4700: local variable 'bReset' used without having been initialized

局部變量“bReset”沒有初始化就使用

error C2018: unknown character '0xa3'

不認識的字符'0xa3'。(一般是漢字或中文標點符號)

error C1010: unexpected end of file while looking for precompiled header directive。

尋找預編譯頭文件路徑時遇到了不該遇到的文件尾。(一般是沒有#include "stdafx.h")

fatal error C1083: Cannot open include file: 'R…….h': No such file or directory

不能打開包含文件“R…….h”:沒有這樣的文件或目錄。

error C2011: 'C……': 'class' type redefinition

類“C……”重定義。

error C2057: expected constant expression

希望是常量表達式。(一般出現在switch語句的case分支中)

error C2065: 'IDD_MYDIALOG' : undeclared identifier

“IDD_MYDIALOG”:未聲明過的標識符。

error C2082: redefinition of formal parameter 'bReset'

函數參數“bReset”在函數體中重定義。

error C2143: syntax error: missing ':' before '{'

句法錯誤:“{”前缺少“;”。

error C2146: syntax error : missing ';' before identifier 'dc'

句法錯誤:在“dc”前丟了“;”。

error C2196: case value '69' already used

值69已經用過。(一般出現在switch語句的case分支中)

error C2509: 'OnTimer' : member function not declared in 'CHelloView'

成員函數“OnTimer”沒有在“CHelloView”中聲明。

error C2511: 'reset': overloaded member function 'void (int)' not found in 'B'

重載的函數“void reset(int)”在類“B”中找不到。

error C2555: 'B::f1': overriding virtual function differs from 'A::f1' only by return type or calling convention

類B對類A中同名函數f1的重載僅根據返回值或調用約定上的區別。

error C2660: 'SetTimer' : function does not take 2 parameters

“SetTimer”函數不傳遞2個參數。

warning C4035: 'f……': no return value

“f……”的return語句沒有返回值。

warning C4553: '= =' : operator has no effect; did you intend '='?

沒有效果的運算符“= =”;是否改為“=”?

warning C4700: local variable 'bReset' used without having been initialized

局部變量“bReset”沒有初始化就使用。

error C4716: 'CMyApp::InitInstance' : must return a value

“CMyApp::InitInstance”函數必須返回一個值。

LINK : fatal error LNK1168: cannot open Debug/P1.exe for writing

連接錯誤:不能打開P1.exe文件,以改寫內容。(一般是P1.Exe還在運行,未關閉)

error LNK2001: unresolved external symbol "public: virtual _ _thiscall C……::~C……(void)"

連接時發現沒有實現的外部符號(變量、函數等)。


常見的出錯信息(按出錯信息字母排序)

Ambiguous operators need parentheses

不明確的運算需要用括號括起

Ambiguous symbol ’xxx’

不明確的符號

Argument list syntax error

參數表語法錯誤

Array bounds missing

丟失數組界限符

Array size toolarge

數組尺寸太大

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

xxx的兩次定義不一致

Register allocation failure

寄存器定址失敗

Repeat count needs an lvalue

重復計數需要邏輯值

Size of structure or array not known

結構體或數給大小不確定

Statement missing ;

語句后缺少";"

Structure or union syntax error

結構體或聯合體語法錯誤

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’

xxx重定義的類型不匹配

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

結構體的長度為零

本文來自互聯網用戶投稿,該文觀點僅代表作者本人,不代表本站立場。本站僅提供信息存儲空間服務,不擁有所有權,不承擔相關法律責任。
如若轉載,請注明出處:http://www.pswp.cn/web/40664.shtml
繁體地址,請注明出處:http://hk.pswp.cn/web/40664.shtml
英文地址,請注明出處:http://en.pswp.cn/web/40664.shtml

如若內容造成侵權/違法違規/事實不符,請聯系多彩編程網進行投訴反饋email:809451989@qq.com,一經查實,立即刪除!

相關文章

MySQL的Geometry數據處理之WKB方案

MySQL的Geometry數據處理之WKT方案&#xff1a;https://blog.csdn.net/qq_42402854/article/details/140134357 MySQL的Geometry數據處理之WKT方案中&#xff0c;介紹WTK方案的優點&#xff0c;也感受到它的繁瑣和缺陷。比如&#xff1a; 需要借助 ST_GeomFromText和 ST_AsTex…

Spring @Cacheable緩存注解用法說明

注解Cacheable 是 Spring 框架中用于緩存數據的方法或類的注解。通過使用這個注解&#xff0c;你可以避免重復計算和重復獲取數據&#xff0c;從而提高應用程序的性能。 基本用法 引入依賴 確保在你的項目中引入了 Spring Cache 相關的依賴。如果你使用的是 Spring Boot&…

中英雙語介紹中國的城市:上海市(Shanghai)

中文版 上海市是中國最大的城市之一&#xff0c;也是全球重要的金融、貿易和航運中心。作為一座現代化的國際大都市&#xff0c;上海以其繁華的商業區、豐富的文化遺產和多樣化的經濟結構而聞名。以下是對上海市的詳細介紹&#xff0c;包括其地理位置、人口、經濟、教育、文化…

qt結合vs2022安裝

進入清華大學開源軟件&#xff1a; 清華大學開源軟件鏡像站 | Tsinghua Open Source Mirror 下載完成后&#xff0c;雙擊進行安裝&#xff1a; 進入郵箱進行驗證&#xff1a; 可能是因為網絡問題&#xff0c;無法安裝。 重新安裝5.12.12版本。 安裝后啟動失敗&#xff0c;重新…

后端接口設計考慮要點

1. 接口參數校驗 入參校驗&#xff1a;確保必要參數不為空&#xff0c;限制長度和格式&#xff08;例如郵箱格式&#xff09;。返回值校驗&#xff1a;確定返回值不為空&#xff0c;為空時返回與前端協商的默認值。 2. 接口擴展性 設計通用接口而非僅針對特定業務流程的接口…

橫截面交易策略:概念與示例

數量技術宅團隊在CSDN學院推出了量化投資系列課程 歡迎有興趣系統學習量化投資的同學&#xff0c;點擊下方鏈接報名&#xff1a; 量化投資速成營&#xff08;入門課程&#xff09; Python股票量化投資 Python期貨量化投資 Python數字貨幣量化投資 C語言CTP期貨交易系統開…

數據結構--單鏈表實現

歡迎光顧我的homepage 前言 鏈表和順序表都是線性表的一種&#xff0c;但是順序表在物理結構和邏輯結構上都是連續的&#xff0c;但鏈表在邏輯結構上是連續的&#xff0c;而在物理結構上不一定連續&#xff1b;來看以下圖片來認識鏈表與順序表的差別 這里以動態順序表…

WGAN(Wassertein GAN)

WGAN E x ~ P g [ log ? ( 1 ? D ( x ) ) ] E x ~ P g [ ? log ? D ( x ) ] \begin{aligned} & \mathbb{E}_{x \sim P_g}[\log (1-D(x))] \\ & \mathbb{E}_{x \sim P_g}[-\log D(x)] \end{aligned} ?Ex~Pg??[log(1?D(x))]Ex~Pg??[?logD(x)]? 原始 GAN …

springboot基于Java的超市進銷存系統+ LW+ PPT+源碼+講解

第三章系統分析與設計 3.1 可行性分析 一個完整的系統&#xff0c;可行性分析是必須要有的&#xff0c;因為他關系到系統生存問題&#xff0c;對開發的意義進行分析&#xff0c;能否通過本網站來補充線下超市進銷存管理模式中的缺限&#xff0c;去解決其中的不足等&#xff0c…

6域名系統DNS

《計算機網絡》第7版&#xff0c;謝希仁 每次記不清楚的知識點&#xff0c;通過上網查找&#xff0c;總是只能看到很零碎的答案。最后還是最喜歡看這個版本的書&#xff0c;一看就回憶起來了&#xff0c;邏輯嚴謹&#xff0c;循循善誘&#xff0c;知識講解的全面又清晰&#xf…

架構師應該在團隊中發揮怎樣的作用?

架構師分為5種&#xff1a; 1.企業架構師EA(Enterprise Architect) EA的職責是決定整個公司的技術路線和技術發展方向。 2.基礎結構架構師IA(Infrastructure Architect) IA的工作就是提煉和優化技術方面積累和沉淀形成的基礎性的、公共的、可復用的框架和組件&#xff0c;這…

Qt 基礎組件速學 鼠標和鍵盤事件

學習目標&#xff1a; 鼠標事件和鍵盤事件應用 前置環境 運行環境:qt creator 4.12 學習內容和效果演示&#xff1a; 1.鼠標事件 根據鼠標的坐標位置&#xff0c;做出對應的事件。 2.鍵盤事件 根據鍵盤的輸入做出對應操作 詳細主要代碼 1.鼠標事件 #include "main…

一文讀懂輕量日志收集系統Loki工作原理

Loki 是由 Grafana Labs 開發的日志聚合系統&#xff0c;設計目標是提供一種高效、低成本的日志收集和查詢解決方案。與傳統的日志系統&#xff08;如 ELK Stack&#xff09;不同&#xff0c;Loki 不會對日志內容進行索引&#xff0c;而是僅對日志的元數據進行索引&#xff0c;…

美國大帶寬服務器租用優勢和注意事項

美國大帶寬服務器租用對于需要處理大量數據和提供高速網絡服務的企業至關重要。下面將詳細討論美國大帶寬服務器租用的優勢、適用場景及注意事項&#xff0c;rak部落小編為您整理發布美國大帶寬服務器租用的優勢和注意事項。 優勢 1. 高速數據傳輸&#xff1a; - 大帶寬服務器提…

FTP、http 、tcp

HTTP VS FTP HTTP &#xff1a;HyperText Transfer Protocol 超文本傳輸協議&#xff0c;是基于TCP協議 FTP&#xff1a; File Transfer Protocol 文件傳輸協議&#xff0c; 基于TCP協議&#xff0c; 基于UDP協議的FTP 叫做 TFTP HTTP 協議 通過一個SOCKET連接傳輸依次會話數…

FIND_IN_SET使用案例--[sql語句根據多ids篩選出對應數據]

一 FIND_IN_SET select id,system_ids from intellect_client_info where FIND_IN_SET(5, system_ids) > 0;

Spring Boot 中的監視器是什么?有什么作用?

前言&#xff1a; 監聽器相信熟悉 Spring、Spring Boot 的都知道&#xff0c;但是監視器又是什么&#xff1f;估計很多人一臉懵的狀態&#xff0c;本篇分享一下 Spring Boot 的監視器。 Spring Boot 系列文章傳送門 Spring Boot 啟動流程源碼分析&#xff08;2&#xff09; …

Apache DolphinScheduler 與 AWS 的 EMR/Redshift 集成實踐分享

引言 這篇文章將給大家講解關于DolphinScheduler與AWS的EMR和Redshift的集成實踐&#xff0c;通過本文希望大家能更深入地了解AWS智能湖倉架構&#xff0c;以及DolphinScheduler在實際應用中的重要性。 AWS智能湖倉架構 首先&#xff0c;我們來看一下AWS經典的智能湖倉架構圖…

【第20章】MyBatis-Plus邏輯刪除支持

文章目錄 前言一、邏輯刪除的工作原理二、支持的數據類型三、使用方法1.配置全局邏輯刪除屬性2.在實體類中使用 TableLogic 注解 四、常見問題解答1. 如何處理插入操作&#xff1f;2. 刪除接口自動填充功能失效怎么辦&#xff1f; 五、實戰1. 全局配置2. 添加TableLogic3. 自動…

高考選專業,興趣與就業前景該如何平衡?

從高考結束的那一刻開始&#xff0c;有些家長和學生就已經變得焦慮了&#xff0c;因為他們不知道成績出來的時候學生應該如何填報志愿&#xff0c;也不知道選擇什么樣的專業&#xff0c;畢竟大學里面的專業豐富多彩&#xff0c;如何選擇確實是一門學問&#xff0c;而對于學生們…