最常见的20种VC++编译错误信息集合

本文汇总并解析了C++编程过程中常见的20种编译错误与警告信息,包括预编译头文件问题、文件找不到、类型重定义、语法错误、函数参数不符等,并给出了可能的原因及解决思路。

<script type="text/javascript"><!-- google_ad_client = "pub-0241434510974184"; /* 博客文章广告728x90, */ google_ad_slot = "7316585398"; google_ad_width = 728; google_ad_height = 90; // --></script><script src="http://pagead2.googlesyndication.com/pagead/show_ads.js" type="text/javascript"></script>

1、fatalerrorC1010:unexpectedendoffilewhilelookingforprecompiledheaderdirective。

  寻找预编译头文件路径时遇到了不该遇到的文件尾。(一般是没有#include"stdafx.h")

  2、fatalerrorC1083:Cannotopenincludefile:'R…….h':Nosuchfileordirectory

  不能打开包含文件“R…….h”:没有这样的文件或目录。

  3、errorC2011:'C……':'class'typeredefinition

  类“C……”重定义。

  4、errorC2018:unknowncharacter'0xa3'

  不认识的字符'0xa3'。(一般是汉字或中文标点符号)

  5、errorC2057:expectedconstantexpression

  希望是常量表达式。(一般出现在switch语句的case分支中)

  6、errorC2065:'IDD_MYDIALOG':undeclaredidentifier

  “IDD_MYDIALOG”:未声明过的标识符。

  7、errorC2082:redefinitionofformalparameter'bReset'

  函数参数“bReset”在函数体中重定义。

  8、errorC2143:syntaxerror:missing':'before'{'

  句法错误:“{”前缺少“;”。

  9、errorC2146:syntaxerror:missing';'beforeidentifier'dc'

  句法错误:在“dc”前丢了“;”。

  10、errorC2196:casevalue'69'alreadyused

  值69已经用过。(一般出现在switch语句的case分支中)

11、errorC2509:'OnTimer':memberfunctionnotdeclaredin'CHelloView'

  成员函数“OnTimer”没有在“CHelloView”中声明。

  12、errorC2511:'reset':overloadedmemberfunction'void(int)'notfoundin'B'

  重载的函数“voidreset(int)”在类“B”中找不到。

  13、errorC2555:'B::f1':overridingvirtualfunctiondiffersfrom'A::f1'onlybyreturntypeorcallingconvention

  类B对类A中同名函数f1的重载仅根据返回值或调用约定上的区别。

  14、errorC2660:'SetTimer':functiondoesnottake2parameters

  “SetTimer”函数不传递2个参数。

  15、warningC4035:'f……':noreturnvalue

  “f……”的return语句没有返回值。

  16、warningC4553:'==':operatorhasnoeffect;didyouintend'='?

  没有效果的运算符“==”;是否改为“=”?

  17、warningC4700:localvariable'bReset'usedwithouthavingbeeninitialized

  局部变量“bReset”没有初始化就使用。

  18、errorC4716:'CMyApp::InitInstance':mustreturnavalue

  “CMyApp::InitInstance”函数必须返回一个值。

  19、LINK:fatalerrorLNK1168:cannotopenDebug/P1.exeforwriting

  连接错误:不能打开P1.exe文件,以改写内容。(一般是P1.Exe还在运行,未关闭)

  20、errorLNK2001:unresolvedexternalsymbol"public:virtual__thiscallC……::~C……(void)"

  连接时发现没有实现的外部符号(变量、函数等)。

  functioncallmissingargumentlist调用函数的时候没有给参数。

  memberfunctiondefinitionlookslikeactor,butnamedoesnotmatchenclosingclass成员函数声明了但没有使用

  unexpectedendoffilewhilelookingforprecompiledheaderdirective在寻找预编译头文件时文件意外结束,编译不正常终止可能造成这种情况

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值