错误内容为:
错误 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”
原因如下:在VS2010的comdef.h文件中有这么两句:struct Font : IFontDisp {};和struct Picture : IPictureDisp {};结果导致老是出现你所说的冲突,但是VC6下就没问题,原因是VC6的comdef.h文件中没有上面的这两句定义。
解决方法是将exce.h和excel.cpp中的内容l添加自定义的命名空间中,假自定义和id命名空间为excel,即按如下做就
将excel.h 文件中的定义的class{}放到 namespace excel{ } 中;
将excel.cpp 文件中 的函数实现部分放到 namespace excel {}中
在#include "excel.h" 时加 using namespace excel;