error C2011: “Font”:“struct”类型重定义
来源:互联网 发布:2017淘宝官方活动大全 编辑:程序博客网 时间:2024/05/16 10:10
在vs2008里添加了在VC6.0里形成的OFFICE库文件的类 excel.h,excel.cpp,就是我在VC6里做操作OFFICE的表格时候添加的库文件,然后把它们( excel.h,excel.cpp)加载vs2008里(因为vs2008里夹在的类在很多的文件夹里,而不是在一个文件夹)
然后就报很多的错误。下面的错误只是一部分,
错误 1 error C2011: “Font”: “struct”类型重定义
错误 2 error C2011: “Picture”: “struct”类型重定义
错误 3 error C2027: 使用了未定义类型“Font”
错误 4 error C3861: “InvokeHelper”: 找不到标识符
错误 5 error C2027: 使用了未定义类型“Font”
错误 6 error C3861: “InvokeHelper”: 找不到标识符
错误 7 error C2027: 使用了未定义类
错误 14 error C3861: “InvokeHelper”: 找不到标识符
错误 15 error C2027: 使用了未定义类型“Font”
错误 16 error C3861: “InvokeHelper”: 找不到标识符
错误 17 error C2027: 使用了未定义类型“Font”
错误 18 error C3861: “InvokeHelper”: 找不到标识符
错误 19 error C2027: 使用了未定义类型“Font”
摸索了半天,总算解决了,原因如下:在VS2008的comdef.h文件中有这么两句:struct Font : IFontDisp {};和struct Picture : IPictureDisp {};结果导致老是出现你所说的冲突,但是VC6下就没问题,原因是VC6的comdef.h文件中没有上面的这两句定义。
解决方法是为excel9添加namespace :
就是在excel9.h的#ifdef...#define...的后面(第一个class的前面)加上namespace excel9 { 再在最后加上结束符号 }
然后在excel9.cpp文件相应位置加上namespace excel9 { ...... }
在你的工作文件中#include "excel9.h" 并在下一行加上 using namespace excel9;
OK,完美解决。
- error C2011: “Font”:“struct”类型重定义
- VS2010,error C2011: “Font”:“struct”类型重定义
- error C2011: “fd_set”: “struct”类型重定义
- socket.error C2011: “sockaddr”: “struct”类型重定义
- VS2013 error C2011: “s_buffer”:“struct”类型重定义
- pthread.h提示error C2011: “timespec”:“struct”类型重定义
- C2011 “timespec”:“struct”类型重定义
- error C2011: “LockTypeEnum”: “enum”类型重定义
- error C2011: “XXX”:“class”类型重定义
- error C2011: “XXX”:“class”类型重定义
- error C2011: “XXX”:“class”类型重定义
- error C2011: “LockTypeEnum”: “enum”类型重定义
- error C2011:" .class":"class"类型重定义
- VC VS2015 pthread.h(320): error C2011: “timespec”:“struct”类型重定义
- error C2011: “CAlarm”: “class”类型重定义【转】
- error C2011: “vc_attributes::YesNoMaybe”: “enum”类型重定义
- error C2011: “Shape”:“class”类型重定义 问题的解决
- VS2012 error C2011: “DXGI_FORMAT”:“enum”类型重定义
- 物件导向的核心重点: 多态
- OC - SEL类型的使用
- LeetCode 55. Jump Game
- hdu2116 java 大数据
- 第三方支付的分类 《非金融机构支付服务管理办法》中的分类
- error C2011: “Font”:“struct”类型重定义
- spring事务管理 junit回滚
- 通过代码 新增 和 “修改”NSLayoutConstraint
- 安装好 ubuntu要做的几件事
- 三角形问题
- onNewIntent()方法何时会被调用
- 集体智慧学习编程—— 学习笔记一
- 分治法——归并排序(MergeSort)
- 使用ViewPagerIndicator结合ViewPager实现网易新闻客户端的Tab标签效果