VS2010,error C2011: “Font”:“struct”类型重定义
来源:互联网 发布:dnf决战人工智能6.2 编辑:程序博客网 时间:2024/05/16 06:39
在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 文件中的定义的class{}放到 namespace excel9{ } 中;
将excel9.cpp 文件中 #ifdef...#define...的后面内容,放到 namespace excel9 {}中。
在#include "excel9.h" 时加上 using namespace excel9;
- VS2010,error C2011: “Font”:“struct”类型重定义
- 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”类型重定义
- AOP实现(三)--spring2.0中pointcut定义
- Netty简介
- ios 动画基础
- word分节符
- AR技术在魔术上的应用II
- VS2010,error C2011: “Font”:“struct”类型重定义
- Google protobuf的安装及使用
- linux内核struct链表程序与分析
- 生日相同
- 字符全排列java实现(转)
- Git 命令参数及用法详解 & Linux编程环境下版本控制 Git使用
- How To Choose The Best XML Parser for Your iPhone Project
- Windows 64bit 驱动 和 应用开发 笔记
- VC中的DoDataExchange