编译时出现错误如下:

stdafx.h(51) : error C4772: #import referenced a type from a missing type library; '__missing_type__' used as a placeholder

解决方法:先注释掉stdafx.h中51行的代码,编译一遍,然后放开注释再编译一遍

工程中需要引用office库,由于机器上装了多个版本的office,时常会卸载、安装office。由此导致工程时而运行顺利、时而出现如标题所示的错误。        简单地说,问题出在如下注册表项:       HKEY_CLASSES_ROOT \ TypeLib \ {2DF8D04C-5BFA-101B-BDE5-00AA0044DE52} \         在Office安 环境:cpu64,win7 64操作系统,vs2008,office2013,wps2013个人版 1.由于换了一个笔记本,xp->win7,office2010->2013,wps2012->2013,导致原来的代码不能用了 原始代码: #import "lib/wps/2012.8.1.0.2998/kso10.dll" rename("RGB", "KsoRGB") rename 用#import方式引入Word类型库时出现该问题,引入方式: #import "..\\import\\OFFICE12\\MSO.DLL" rename_namespace("Office"),named_guids,exclude("Pages"),rename("RGB","MSORGB"),rename("IAccessible","MSIaccessible") using nam “关于__missing_type__ error ” 1. error C4772 : #import referenced a type from a missing type library; '__missing_type__' used as a placeholder error 2.C2516: '__miss... Visual C++ Concepts: Building a C/C++ Program  Compiler Warning (level 1) C4772 Error Message #import referenced a type from a missing type library; missing_type used as a placehol 深入了解该类型错误原因,生成的tli文件中出现__misstype__是因为导入dll或者tlb的类型不识别。通过对比公司正常编译生成的tli文件,发现是xmlDocumentPtr指针为识别, 由于编译的是64位并且工程目录下均包括了msxml6.dll和msxml4.dll文件; #import tlb 文件如果存在继承式的依赖,编译时会导致 c4772 错误,有时发现即使正确引用了,仍然 c4772 ,此时可以尝试把所有的tlb文件放到工程目录下。也许可以解决。 如果 没有 MicrosoftSDK2003 windows 2003 版本的 SDK 就尝试 替换下=============================================== 按装新的 soapsdk.exe 这个 是我从微软 官方下载的,先安装它。 接下来========================================================= 但要确保你按装的 有SDK 假如你的 SDK 是安装在 C:\ 就需要 C:\Program Files\Common Files 文件夹下 替换掉该文件 这样 应该没问题 如果还是有问题 那还是SDK 的问题 下载新的 Windows 2003 SDK 版本 重新安装 安装后查看 MSSOAP30.dll SOAPIS30.dll WHSC30.dll 文件的属性 版本 确保为:3.0.1325.0 (case=12161) Removed C-style comment and semicolon from Encapsulate Field in Visual Basic files. (case=11160, case=4475) 7107 Object methods called on boxed string literals in C# are parsed ...