问题描述
- CLR工程,using Microsoft.Office.Interop.Excel后编译报错
- 目的:用VS2008创建CLR窗体工程后,需要导出数据到Excel
添加microsoft excel 11.0 object library后,代码里面写入using Microsoft.Office.Interop.Excel,编译就报错,非常的怪异。
哪位大虾帮忙看看什么原因?谢谢!
.selectdemo.cpp(12) : error C2872: 'Application' : ambiguous symbol
1> could be 'c:program filesmicrosoft visual studio 9.0visual studio tools for officepiaoffice12microsoft.office.interop.excel.dll : Microsoft::Office::Interop::Excel::Application'
1> or 'c:windowsmicrosoft.netframeworkv2.0.50727system.windows.forms.dll : System::Windows::Forms::Application'
1>.selectdemo.cpp(12) : error C2039: 'EnableVisualStyles' : is not a member of 'Microsoft::Office::Interop::Excel::Application'
1> c:program filesmicrosoft visual studio 9.0visual studio tools for officepiaoffice12microsoft.office.interop.excel.dll : see declaration of 'Microsoft::Office::Interop::Excel::Application'
1>.selectdemo.cpp(12) : error C3861: 'EnableVisualStyles': identifier not found
1>.selectdemo.cpp(13) : error C2872: 'Application' : ambiguous symbol
1> could be 'c:program filesmicrosoft visual studio 9.0visual studio tools for officepiaoffice12microsoft.office.interop.excel.dll : Microsoft::Office::Interop::Excel::Application'
1> or 'c:windowsmicrosoft.netframeworkv2.0.50727system.windows.forms.dll : System::Windows::Forms::Application'
1>.selectdemo.cpp(13) : error C2039: 'SetCompatibleTextRenderingDefault' : is not a member of 'Microsoft::Office::Interop::Excel::Application'
1> c:program filesmicrosoft visual studio 9.0visual studio tools for officepiaoffice12microsoft.office.interop.excel.dll : see declaration of 'Microsoft::Office::Interop::Excel::Application'
1>.selectdemo.cpp(13) : error C3861: 'SetCompatibleTextRenderingDefault': identifier not found
1>.selectdemo.cpp(16) : error C2872: 'Application' : ambiguous symbol
1> could be 'c:program filesmicrosoft visual studio 9.0visual studio tools for officepiaoffice12microsoft.office.interop.excel.dll : Microsoft::Office::Interop::Excel::Application'
1> or 'c:windowsmicrosoft.netframeworkv2.0.50727system.windows.forms.dll : System::Windows::Forms::Application'1>.selectdemo.cpp(16) : error C2660: 'Microsoft::Office::Interop::Excel::_Application::Run' : function does not take 1 arguments