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 files\microsoft visual studio 9.0\visual studio tools for office\pia\office12\microsoft.office.interop.excel.dll : Microsoft::Office::Interop::Excel::Application'
1> or 'c:\windows\microsoft.net\framework\v2.0.50727\system.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 files\microsoft visual studio 9.0\visual studio tools for office\pia\office12\microsoft.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 files\microsoft visual studio 9.0\visual studio tools for office\pia\office12\microsoft.office.interop.excel.dll : Microsoft::Office::Interop::Excel::Application'
1> or 'c:\windows\microsoft.net\framework\v2.0.50727\system.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 files\microsoft visual studio 9.0\visual studio tools for office\pia\office12\microsoft.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 files\microsoft visual studio 9.0\visual studio tools for office\pia\office12\microsoft.office.interop.excel.dll : Microsoft::Office::Interop::Excel::Application'
1> or 'c:\windows\microsoft.net\framework\v2.0.50727\system.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

查看全部
pc_luckyboy
pc_luckyboy
2014/04/08 13:15
  • clr excel
  • 点赞
  • 收藏
  • 回答
    私信

1个回复