MFC工程 : view.h 包含错误, 提示 undeclared identifier 等错误

本文介绍了解决在C++编程中因头文件引入顺序不当导致的编译错误的方法。通过一个具体的例子展示了如何正确地组织头文件的引入顺序,避免出现未声明的标识符等问题。

比如已有: testView.h testDoc.h resource.h mynewfile.cpp

如果要在mynewfile.cpp中添加testView.h, 有时会提示 undeclared identifier 等错误.
所以需要在mynewfile.cpp添加testView.h之前,添加testDoc.h resource.h. 这样就不会有问题了.
'void __thiscall CMap1View::OnRGBSplit(void)' : overloaded function differs only by return type from 'int __thiscall CMap1View::OnRGBSplit(void)' d:\vc6.0\microsoft visual studio\myprojects\map1\map1view.h(22) : see declaration of 'OnRGBSplit' D:\VC6.0\Microsoft Visual Studio\MyProjects\map1\map1View.cpp(110) : error C2371: 'OnRGBSplit' : redefinition; different basic types d:\vc6.0\microsoft visual studio\myprojects\map1\map1view.h(22) : see declaration of 'OnRGBSplit' D:\VC6.0\Microsoft Visual Studio\MyProjects\map1\map1View.cpp(111) : error C2065: 'm_image' : undeclared identifier D:\VC6.0\Microsoft Visual Studio\MyProjects\map1\map1View.cpp(111) : error C2228: left of '.empty' must have class/struct/union type D:\VC6.0\Microsoft Visual Studio\MyProjects\map1\map1View.cpp(112) : error C2143: syntax error : missing ')' before '{' D:\VC6.0\Microsoft Visual Studio\MyProjects\map1\map1View.cpp(118) : error C2065: 'vector' : undeclared identifier D:\VC6.0\Microsoft Visual Studio\MyProjects\map1\map1View.cpp(118) : error C2065: 'Mat' : undeclared identifier D:\VC6.0\Microsoft Visual Studio\MyProjects\map1\map1View.cpp(118) : error C2065: 'channels' : undeclared identifier D:\VC6.0\Microsoft Visual Studio\MyProjects\map1\map1View.cpp(118) : warning C4804: '>' : unsafe use of type 'bool' in operation D:\VC6.0\Microsoft Visual Studio\MyProjects\map1\map1View.cpp(118) : warning C4552: '>' : operator has no effect; expected operator with side-effect D:\VC6.0\Microsoft Visual Studio\MyProjects\map1\map1View.cpp(119) : error C2065: 'split' : undeclared identifier D:\VC6.0\Microsoft Visual Studio\MyProjects\map1\map1View.cpp(121) : error C2001: newline in constant D:\VC6.0\Microsoft Visual Studio\MyProjects\map1\map1View.cpp(121) : fatal error C1057: unexpected end of file in macro expansion
最新发布
10-15
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值