导入库的语句如下:
#import "typelib\mso.dll" named_guids,rename_namespace("Office")
using namespace Office;
#import "typelib\VBE6EXT.olb" rename_namespace("VBE6")
using namespace VBE6;
#import "typelib\MSWORD.OLB" rename("ExitWindows","ExitWindowsEx"),rename_namespace("MSWord")
using namespace MSWord;
#import "typelib\EXCEL9.olb" rename("RGB","RGBEx"),rename("DialogBox","DialogBoxEx"),rename_namespace("MSExcel")
using namespace MSExcel;
#import "typelib\MSPPT9.OLB" rename("FileDialog","FileDialogEx"),rename_namespace("MSPPT")
using namespace MSPPT;错误结果如下:
1>e:\lesson\dsoframer6\vc示例\stdafx.h(36) : error C2872: “ColorFormat”: 不明确的符号
1>        可能是“e:\lesson\dsoframer6\vc示例\release\msword.tlh(9047) : myMSWord::ColorFormat”
1>        或       “e:\lesson\dsoframer6\vc示例\release\mso.tlh(1926) : Office::ColorFormat”
1>e:\lesson\dsoframer6\vc示例\stdafx.h(36) : error C2872: “ColorFormat”: 不明确的符号
1>        可能是“e:\lesson\dsoframer6\vc示例\release\msword.tlh(9047) : myMSWord::ColorFormat”
1>        或       “e:\lesson\dsoframer6\vc示例\release\mso.tlh(1926) : Office::ColorFormat”
1>e:\lesson\dsoframer6\vc示例\stdafx.h(36) : warning C4192: 导入类型库“IFont”时自动排除“typelib\EXCEL9.olb”
1>e:\lesson\dsoframer6\vc示例\stdafx.h(36) : warning C4192: 导入类型库“IPicture”时自动排除“typelib\EXCEL9.olb”
1>e:\lesson\dsoframer6\vc示例\stdafx.h(36) : error C2872: “Application”: 不明确的符号
1>        可能是“e:\lesson\dsoframer6\vc示例\release\msword.tlh(593) : myMSWord::Application”
1>        或       “e:\lesson\dsoframer6\vc示例\release\vbe6ext.tlh(175) : VBE6::Application”
1>        可能是“e:\lesson\dsoframer6\vc示例\release\msword.tlh(593) : myMSWord::Application”
1>        或       “e:\lesson\dsoframer6\vc示例\release\vbe6ext.tlh(175) : VBE6::Application”
1>e:\lesson\dsoframer6\vc示例\stdafx.h(36) : error C2872: “Window”: 不明确的符号
1>        可能是“e:\lesson\dsoframer6\vc示例\release\msword.tlh(22634) : myMSWord::Window”
1>        或       “e:\lesson\dsoframer6\vc示例\release\vbe6ext.tlh(700) : VBE6::Window”
1>e:\lesson\dsoframer6\vc示例\stdafx.h(36) : error C2872: “Application”: 不明确的符号
1>        可能是“e:\lesson\dsoframer6\vc示例\release\msword.tlh(593) : myMSWord::Application”
1>        或       “e:\lesson\dsoframer6\vc示例\release\vbe6ext.tlh(175) : VBE6::Application”
1>e:\lesson\dsoframer6\vc示例\stdafx.h(36) : error C2872: “Application”: 不明确的符号
1>        可能是“e:\lesson\dsoframer6\vc示例\release\msword.tlh(593) : myMSWord::Application”
1>        或       “e:\lesson\dsoframer6\vc示例\release\vbe6ext.tlh(175) : VBE6::Application”
1>e:\lesson\dsoframer6\vc示例\stdafx.h(36) : error C2872: “Font”: 不明确的符号
1>        可能是“C:\Program Files\Microsoft Visual Studio 9.0\VC\include\comdef.h(312) : Font”
1>        或       “e:\lesson\dsoframer6\vc示例\release\msword.tlh(597) : myMSWord::Font”
1>e:\lesson\dsoframer6\vc示例\stdafx.h(36) : error C2872: “Application”: 不明确的符号
1>        可能是“e:\lesson\dsoframer6\vc示例\release\msword.tlh(593) : myMSWord::Application”
1>        或       “e:\lesson\dsoframer6\vc示例\release\vbe6ext.tlh(175) : VBE6::Application”
1>e:\lesson\dsoframer6\vc示例\stdafx.h(36) : error C2872: “Application”: 不明确的符号
1>        可能是“e:\lesson\dsoframer6\vc示例\release\msword.tlh(593) : myMSWord::Application”
1>        或       “e:\lesson\dsoframer6\vc示例\release\vbe6ext.tlh(175) : VBE6::Application”
1>e:\lesson\dsoframer6\vc示例\stdafx.h(36) : error C2872: “Font”: 不明确的符号
1>        可能是“C:\Program Files\Microsoft Visual Studio 9.0\VC\include\comdef.h(312) : Font”
1>        或       “e:\lesson\dsoframer6\vc示例\release\msword.tlh(597) : myMSWord::Font”
1>e:\lesson\dsoframer6\vc示例\stdafx.h(36) : error C2872: “Application”: 不明确的符号
1>        可能是“e:\lesson\dsoframer6\vc示例\release\msword.tlh(593) : myMSWord::Application”
1>        或       “e:\lesson\dsoframer6\vc示例\release\vbe6ext.tlh(175) : VBE6::Application”
1>e:\lesson\dsoframer6\vc示例\stdafx.h(36) : warning C4278: “CopyFile”: 类型库“typelib\EXCEL9.olb”中的标识符已经是宏;使用“rename”限定符
1>e:\lesson\dsoframer6\vc示例\stdafx.h(36) : error C2872: “AddIn”: 不明确的符号
1>        可能是“e:\lesson\dsoframer6\vc示例\release\msword.tlh(6834) : myMSWord::AddIn”
1>        或       “e:\lesson\dsoframer6\vc示例\release\vbe6ext.tlh(1489) : VBE6::AddIn”
1>e:\lesson\dsoframer6\vc示例\stdafx.h(36) : error C2872: “Application”: 不明确的符号
1>        可能是“e:\lesson\dsoframer6\vc示例\release\msword.tlh(593) : myMSWord::Application”
1>        或       “e:\lesson\dsoframer6\vc示例\release\vbe6ext.tlh(175) : VBE6::Application”
1>e:\lesson\dsoframer6\vc示例\stdafx.h(36) : error C2872: “Application”: 不明确的符号
1>e:\lesson\dsoframer6\vc示例\stdafx.h(36) : error C2872: “Window”: 不明确的符号
1>        可能是“e:\lesson\dsoframer6\vc示例\release\msword.tlh(22634) : myMSWord::Window”
1>        或       “e:\lesson\dsoframer6\vc示例\release\vbe6ext.tlh(700) : VBE6::Window”
1>e:\lesson\dsoframer6\vc示例\stdafx.h(36) : error C2872: “Window”: 不明确的符号
1>e:\lesson\dsoframer6\vc示例\stdafx.h(36) : error C2872: “Application”: 不明确的符号
1>        可能是“e:\lesson\dsoframer6\vc示例\release\msword.tlh(593) : myMSWord::Application”
1>        或       “e:\lesson\dsoframer6\vc示例\release\vbe6ext.tlh(175) : VBE6::Application”
1>e:\lesson\dsoframer6\vc示例\stdafx.h(36) : error C2872: “ShapeRange”: 不明确的符号
1>        可能是“e:\lesson\dsoframer6\vc示例\release\msword.tlh(35675) : myMSWord::ShapeRange”
1>        或       “e:\lesson\dsoframer6\vc示例\release\mso.tlh(9914) : Office::ShapeRange”
1>e:\lesson\dsoframer6\vc示例\stdafx.h(36) : error C2872: “Font”: 不明确的符号
1>        可能是“C:\Program Files\Microsoft Visual Studio 9.0\VC\include\comdef.h(312) : Font”
1>        或       “e:\lesson\dsoframer6\vc示例\release\msword.tlh(597) : myMSWord::Font”
1>e:\lesson\dsoframer6\vc示例\stdafx.h(36) : error C2872: “Application”: 不明确的符号
1>        可能是“e:\lesson\dsoframer6\vc示例\release\msword.tlh(593) : myMSWord::Application”
1>        或       “e:\lesson\dsoframer6\vc示例\release\vbe6ext.tlh(175) : VBE6::Application”

解决方案 »

  1.   

    錯誤訊息'symbol' : 模稜兩可的符號
    編譯器無法判斷您參考至那一個符號。如果標頭檔包含 using Directive (C++),而後續標頭檔也用 #include 包含在內,其中包含也在 using 指示詞中所指定命名空間中的型別,可能會發生 C2872。請在所有標頭檔都以 #include 指定以後,再指定 using 指示詞。如需有關 C2872 的詳細資訊,請參閱 http://support.microsoft.com/default.aspx?scid=kb;en-us;316317。
      

  2.   

    将所有using语句移到所有#import语句后