我采用Com技术调用了Excel开发数据表的设计,但遇到了一个问题调用Excel后,生成了excel.h,excel.app(EXCEL2003版本),我在一个Class的.h文件中使用#include "excel.h",然而在另外一个Class中再次引用#include "excel.h"就会出现以下问题:
Compiling...
ExcelTest.cpp
D:\ExcelTest\Excel.h(5) : error C2011: '_Application' : 'class' type redefinition
D:\ExcelTest\Excel.h(350) : error C2011: '_Worksheet' : 'class' type redefinition
D:\ExcelTest\Excel.h(471) : error C2011: '_Workbook' : 'class' type redefinition
D:\ExcelTest\Excel.h(664) : error C2011: 'Workbooks' : 'class' type redefinition
D:\ExcelTest\Excel.h(698) : error C2011: 'Range' : 'class' type redefinition
D:\ExcelTest\Excel.h(923) : error C2011: 'Worksheets' : 'class' type redefinition
ExcelTestDlg.cpp
D:\ExcelTest\Excel.h(5) : error C2011: '_Application' : 'class' type redefinition
D:\ExcelTest\Excel.h(350) : error C2011: '_Worksheet' : 'class' type redefinition
D:\ExcelTest\Excel.h(471) : error C2011: '_Workbook' : 'class' type redefinition
D:\ExcelTest\Excel.h(664) : error C2011: 'Workbooks' : 'class' type redefinition
D:\ExcelTest\Excel.h(698) : error C2011: 'Range' : 'class' type redefinition
D:\ExcelTest\Excel.h(923) : error C2011: 'Worksheets' : 'class' type redefinition
d:\exceltest\release\msado15.tlh(407) : warning C4146: unary minus operator applied to unsigned type, result still unsigned
SelItm.cpp
Generating Code...
D:\ExcelTest\SelItm.cpp(223) : warning C4715: 'CSelItm::GetIndex' : not all control paths return a value
Error executing cl.exe.