一开始使用vc6,在导入excel.exe后会自动生成excel.h和excel.cpp,然后project可以编译通过。
后来换到了vs2010,同样是导入excel.exe,但project无法通过编译,报了一堆错误,全都分布在excel.tlh和excel.thi里面,搞了一天最后终于解决了!但问题原因依然莫名奇妙!坑爹的MS啊!
PS:
vc中嵌入excel的链接
http://support.microsoft.com/kb/307473
http://support.microsoft.com/kb/311546/en-us
解决问题的链接
http://support.microsoft.com/kb/316587
编译时出现的出现:
1>e:\code\visual studio 2010\projects\simapp\simapp\debug\excel.tlh(550): error C3121: cannot change GUID for class 'IFilter'
1> c:\program files\microsoft sdks\windows\v7.0a\include\filter.h(183) : see declaration of 'IFilter'
1>e:\code\visual studio 2010\projects\simapp\simapp\debug\excel.tlh(1471): error C2371: 'FontPtr' : redefinition; different basic types
1> d:\program files\microsoft visual studio 10.0\vc\include\comdef.h(314) : see declaration of 'FontPtr'
1>e:\code\visual studio 2010\projects\simapp\simapp\debug\excel.tlh(1549): error C2786: 'BOOL (HDC,int,int,int,int)' : invalid operand for __uuidof
1>e:\code\visual studio 2010\projects\simapp\simapp\debug\excel.tlh(1549): error C2923: '_com_IIID' : 'Rectangle' is not a valid template type argument for parameter '_Interface'
1> c:\program files\microsoft sdks\windows\v7.0a\include\wingdi.h(3989) : see declaration of 'Rectangle'
1>e:\code\visual studio 2010\projects\simapp\simapp\debug\excel.tlh(1549): error C3203: '_com_IIID' : unspecialized class template can't be used as a template argument for template parameter '_IIID', expected a real type
1>e:\code\visual studio 2010\projects\simapp\simapp\debug\excel.tlh(1549): error C2955: '_com_IIID' : use of class template requires template argument list
1> d:\program files\microsoft visual studio 10.0\vc\include\comip.h(40) : see declaration of '_com_IIID'
1>e:\code\visual studio 2010\projects\simapp\simapp\debug\excel.tlh(1553): error C2786: 'BOOL (HDC,int,int,int,int,int,int,int,int)' : invalid operand for __uuidof
1>e:\code\visual studio 2010\projects\simapp\simapp\debug\excel.tlh(1553): error C2923: '_com_IIID' : 'Arc' is not a valid template type argument for parameter '_Interface'
1> c:\program files\microsoft sdks\windows\v7.0a\include\wingdi.h(3235) : see declaration of 'Arc'
1>e:\code\visual studio 2010\projects\simapp\simapp\debug\excel.tlh(1553): error C3203: '_com_IIID' : unspecialized class template can't be used as a template argument for template parameter '_IIID', expected a real type
1>e:\code\visual studio 2010\projects\simapp\simapp\debug\excel.tlh(1553): error C2955: '_com_IIID' : use of class template requires template argument list
1> d:\program files\microsoft visual studio 10.0\vc\include\comip.h(40) : see declaration of '_com_IIID'
1>e:\code\visual studio 2010\projects\simapp\simapp\debug\excel.tlh(1560): error C2371: 'PicturePtr' : redefinition; different basic types
1> d:\program files\microsoft visual studio 10.0\vc\include\comdef.h(328) : see declaration of 'PicturePtr'
1>e:\code\visual studio 2010\projects\simapp\simapp\debug\excel.tlh(2046): error C2504: '_IMsoDispObj' : base class undefined
1>e:\code\visual studio 2010\projects\simapp\simapp\debug\excel.tlh(2088): error C2504: '_IMsoDispObj' : base class undefined
1>e:\code\visual studio 2010\projects\simapp\simapp\debug\excel.tlh(2190): error C2504: '_IMsoDispObj' : base class undefined
1>e:\code\visual studio 2010\projects\simapp\simapp\debug\excel.tlh(2209): error C2146: syntax error : missing ';' before identifier 'GetRGB'
1>e:\code\visual studio 2010\projects\simapp\simapp\debug\excel.tlh(2209): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>e:\code\visual studio 2010\projects\simapp\simapp\debug\excel.tlh(2209): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>e:\code\visual studio 2010\projects\simapp\simapp\debug\excel.tlh(2209): warning C4183: 'GetRGB': missing return type; assumed to be a member function returning 'int'
1>e:\code\visual studio 2010\projects\simapp\simapp\debug\excel.tlh(2211): error C2061: syntax error : identifier 'MsoRGBType'
1>e:\code\visual studio 2010\projects\simapp\simapp\debug\excel.tlh(2230): error C2061: syntax error : identifier 'MsoRGBType'
1>e:\code\visual studio 2010\projects\simapp\simapp\debug\excel.tlh(2232): error C2061: syntax error : identifier 'MsoRGBType'
1>e:\code\visual studio 2010\projects\simapp\simapp\debug\excel.tlh(2251): error C2504: '_IMsoDispObj' : base class undefined
1>e:\code\visual studio 2010\projects\simapp\simapp\debug\excel.tlh(2381): error C2504: '_IMsoDispObj' : base class undefined
1>e:\code\visual studio 2010\projects\simapp\simapp\debug\excel.tlh(2420): error C2504: '_IMsoDispObj' : base class undefined
1>e:\code\visual studio 2010\projects\simapp\simapp\debug\excel.tlh(2503): error C2504: '_IMsoDispObj' : base class undefined
……………………………………
……………………………………
……………………………………
分享到:
相关推荐
VS使用MFC操作EXCEL,新建编辑保存等操作,VS使用MFC操作EXCEL,新建编辑保存等操作,VS使用MFC操作EXCEL,新建编辑保存等操作
vs2019直接可以编译执行的mfc操作excel类库
C++MFC 使用VS2010导出Excel的方法及步骤 ,基本方法与步骤,带有少量的代码实例,具有参考意义
MFC自动化操作Excel,有基本的函数介绍。
VS2019 MFC下使用ODBC读写EXCEL表格
VS2010建立MFC工程,读写excel操作类
MFC操作excel边框,添加边框
主要内容: 1、MFC调用Excel文件。 2、向Excel文件中写入数据并保存。 3、从控件中赌球数据放入Excel中。 4、实现了MFC与Excel数据之间的传递。
mfc操作excel,进行类对象和方法的封装。
本程序通过mfc 操作访问excel,在vs2005环境下调试通过。代码中的excel.h excel.cpp 通过vc6.0生成的
使用MFC自动化操作Excel文档,对excel所包含的类进行详解,比较全面系统的总结了其中各类的用法
VS2010编写,MFC操作EXCEL2010的简单封装,包含写入内容,批量导入数据,设置字体、字体颜色、单元格背景颜色、合并单元格、居中、边框、插入图片等基本操作
对Word、Excel做了基本封装,可以对Excel操作生成Chart图
基于vs2010 mfc实现对excel文件的打开,读取,操作(案例中把数据*2),最后存储
在VS2010中MFC实现对Excel表格的动态读、写、创建。其中包含详细的实现过程截图,简单易懂。
vc++使用MFC操作EXCEL文件 创建+编辑+保存 详细过程及VC源文件
mfc程序,读取excel内容,并回显至listctrl控件上
MFC ListControl与Excel 数据导入导出Demo IDE:VS2010
VS2010-MFC VS2010的MFC例子代码
MFC操作Excel文件,Excel文件的读写,VC对EXCEL文件操作很好的例子