对word编程,导入dll时候,报了好多错误

emmai 2003-08-15 10:01:37
Compiling...
StdAfx.cpp
d:\wordaddin\releasemindependency\VBE6EXT.tlh(212) : error C2146: syntax error : missing ';' before identifier 'CommandBars'
d:\wordaddin\releasemindependency\VBE6EXT.tlh(212) : error C2501: '__missing_type__' : missing storage-class or type specifiers
d:\wordaddin\releasemindependency\VBE6EXT.tlh(212) : error C2501: 'CommandBars' : missing storage-class or type specifiers
d:\wordaddin\releasemindependency\VBE6EXT.tlh(233) : error C2146: syntax error : missing ';' before identifier 'GetCommandBars'
d:\wordaddin\releasemindependency\VBE6EXT.tlh(233) : error C2501: '__missing_type__' : missing storage-class or type specifiers
d:\wordaddin\releasemindependency\VBE6EXT.tlh(255) : error C2061: syntax error : identifier '__missing_type__'
d:\wordaddin\releasemindependency\VBE6EXT.tli(32) : error C2143: syntax error : missing ';' before 'tag::id'
d:\wordaddin\releasemindependency\VBE6EXT.tli(32) : error C2433: '__missing_type__' : 'inline' not permitted on data declarations
d:\wordaddin\releasemindependency\VBE6EXT.tli(32) : error C2501: '__missing_type__' : missing storage-class or type specifiers
d:\wordaddin\releasemindependency\VBE6EXT.tli(32) : fatal error C1004: unexpected end of file found
Error executing cl.exe.

WordAddin.dll - 10 error(s), 0 warning(s)
...全文
355 10 打赏 收藏 转发到动态 举报
写回复
用AI写文章
10 条回复
切换为时间正序
请发表友善的回复…
发表回复
emmai 2003-08-19
  • 打赏
  • 举报
回复
可能是xp的原因,可惜手上没有office2000的盘
不过问题已经变向解决了
zzyx 2003-08-19
  • 打赏
  • 举报
回复
俺刚才试过也没有问题,难道是office版本问题?

The typelib for Microsoft Office 97 is in the file Mso97.dll. The typelib for Microsoft Office 2000 is Mso9.dll. The default location is C:\Program Files\Microsoft Office\mso.dll. The typelib for Microsoft Office 2002 is Mso.dll. The default location is C:\Program Files\Common Files\Microsoft Shared\Office10.

emmai 2003-08-18
  • 打赏
  • 举报
回复
楼上贴出来的我都试了,文件都是存在的,错误还是那几个错误
现在的问题归结到VBE6EXT.OLB上了,而且全部是关于里面的CommandBars,
我查了MSDN关于Compiler Error C2772
上面说_missing_type_的发生是因为找不到或者没有正确注册secondary type library,
现在我不知道这个secondary type library是什么,或者说CommandBars是在哪个类型库里?


这是关于C2772 MSDN里的说明
Compiler Error C2772
#import referenced a type from a missing type library; '__missing_type__' used as a place holder

While the compiler was processing the type library named by the #import directive, it encountered a referenced type defined in a secondary type library. In addition, this secondary type library could not be found, and the compiler could not send this typename to the type library headers. A dummy typename, "__missing_type__", was sent to the output instead. This will trigger additional errors as the type library headers are compiled.

This error occurs when the secondary type library is not properly registered or missing. When the compiler detects this error, it cannot determine the name of the missing secondary type library. Search for the string "__missing_type__" in the type library headers. This may help determine the name of the secondary type library.

ejiue 2003-08-18
  • 打赏
  • 举报
回复
学习来了。
up一下。
sunyuan_01 2003-08-17
  • 打赏
  • 举报
回复
#import "C:\\Program Files\\Common Files\\Microsoft Shared\\Office10\\MSO.DLL" rename_namespace("Office")
using namespace Office;

#import "C:\\Program Files\\Common Files\\Microsoft Shared\\VBA\\VBA6\\VBE6EXT.olb" rename_namespace("VBE6")
using namespace VBE6;

#import "C:\\Program Files\\Microsoft Office\\Office10\\MSWORD.olb" rename("ExitWindows","ExitWindowsEx"),named_guids,rename_namespace("MSWord")
using namespace MSWord;

试一下,我用没问题
Cline 2003-08-17
  • 打赏
  • 举报
回复
为什么我编译没有问题呢?

你再看看#import的说明 :
If a type library includes references to types defined in other type libraries, then the .TLH file will include comments of the following sort:

//
// Cross-referenced type libraries:
//
// #import "c:\path\typelib0.tlb"
//
The actual filename in the #import comment is the full path of the cross-referenced type library, as stored in the registry. If you encounter errors that are due to missing type definitions, check the comments at the head of the .TLH to see which dependent type libraries may need to be imported first. Likely errors are syntax errors (for example, C2143, C2146, C2321), C2501 (missing decl-specifiers), or C2433 ('inline' not permitted on data declaration) while compiling the .TLI file.

You must determine which of the dependency comments are not otherwise provided for by system headers and then provide an #import directive at some point before the #import directive of the dependent type library to resolve the errors.

emmai 2003-08-17
  • 打赏
  • 举报
回复
现在发现,问题全在VBE6EXT.OLB那里............
期待高手ing.....
emmai 2003-08-15
  • 打赏
  • 举报
回复
导入语句是这样写的

#import "D:\Program Files\Common Files\Microsoft Shared\Office10\MSO.DLL" rename_namespace("Office")
using namespace Office;

#import "D:\Program Files\Common Files\Microsoft Shared\VBA\VBA6\\VBE6EXT.OLB" rename_namespace("VBE6")
using namespace VBE6;

#import "D:\Program Files\Microsoft Office\Office10\MSWORD.OLB" named_guids,rename_namespace("MSWORD")
using namespace MSWORD;
emmai 2003-08-15
  • 打赏
  • 举报
回复
不知道是怎么回事啊
karlson0211 2003-08-15
  • 打赏
  • 举报
回复
严重关注,我也出现了这样的问题!
帮你up一下!

3,245

社区成员

发帖
与我相关
我的任务
社区描述
ATL,Active Template Library活动(动态)模板库,是一种微软程序库,支持利用C++语言编写ASP代码以及其它ActiveX程序。
社区管理员
  • ATL/ActiveX/COM社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧