【发布时间】:2012-02-09 12:26:25
【问题描述】:
我在 C++ Builder 中有一个大型项目,似乎使用了函数导入类型库。里面有一个像这样标题的文件
// ************************************************************************ //
// WARNING
// -------
// The types declared in this file were generated from data read from a
// Type Library. If this type library is explicitly or indirectly (via
// another type library referring to this type library) re-imported, or the
// 'Refresh' command of the Type Library Editor activated while editing the
// Type Library, the contents of this file will be regenerated and all
// manual modifications will be lost.
// ************************************************************************ //
// C++ TLBWRTR : $Revision: 1.134.1.41 $
// File generated on 2003-10-27 12:57:05 from Type Library described below.
// ************************************************************************ //
// Type Lib: C:\WINNT\system32\MQOA.DLL (1)
// IID\LCID: {D7D6E071-DCCD-11D0-AA4B-0060970DEBAE}\0
// Helpfile:
// DepndLst:
// (1) v2.0 stdole, (C:\WINNT\System32\stdole2.tlb)
// (2) v4.0 StdVCL, (C:\WINNT\System32\STDVCL40.DLL)
// ************************************************************************ //
#ifndef __MSMQ_OCX_h__
#define __MSMQ_OCX_h__
#pragma option push -b -w-inl
#include <utilcls.h>
#if !defined(__UTILCLS_H_VERSION) || (__UTILCLS_H_VERSION < 0x0500)
//
// The code generated by the TLIBIMP utility or the Import|TypeLibrary
// and Import|ActiveX feature of C++Builder rely on specific versions of
// the header file UTILCLS.H found in the INCLUDE\VCL directory. If an
// older version of the file is detected, you probably need an update/patch.
//
#error "This file requires a newer version of the header UTILCLS.H" \
"You need to apply an update/patch to your copy of C++Builder"
#endif
#include <olectl.h>
#include <ocidl.h>
#if !defined(_NO_VCL)
#include <stdvcl.hpp>
#endif // _NO_VCL
#include <ocxproxy.h>
...
如您所见,该文件是很久以前生成的 :)。我已经能够在 Windows 7 64 位 上使用 C++ Builder 2010 构建这个项目。但是当我安装 XE2 并尝试修复所有出现的小问题时,因为它现在默认为 STRICT 而不是 NO_STRICT,我遇到了完全不同的问题。上述文件,广告其他以相同方式生成的文件,它们不再按预期工作。
我收到类似
的错误[BCC32 错误] MSMQ_OCX.h(66):E2090 限定符“Oleserver”不是 类或命名空间名称
寻找它声称没有使用任何类型的 MQOA.DLL 似乎存在。在将项目更新到 XE2 时,是否有人对如何解决此类问题有任何指示?该项目在之前的升级中幸存下来,最后升级到 C++ Builder 2010。但我更喜欢 Visual Studio,所以很多 Embarcadero 的东西都是新领域。
【问题讨论】:
-
您是否尝试过将 TypeLibrary 重新导入 XE2 而不是重新使用旧的 .h 文件?
-
我该怎么做?我以为我要查找使用的文件,例如 C:\WINNT\system32\MQOA.DLL 在这种情况下。但此文件在 Windows 7 中不存在。
-
如果您没有安装该文件,即使您的项目编译正常,您如何期望您的应用在运行时使用 TypeLibrary/Object?
-
这有点奇怪。由于在 C++ Builder 2010 中,完全相同的代码可以编译和工作,但 dll 仍然不存在。我的观点是 Embarcadero 是一堆巫毒魔法:)
-
编译不需要DLL。但如果您实际使用的是 TypeLibrary 中定义的 COM 对象,则在运行时确实需要它。
标签: c++builder c++builder-2010 typelib c++builder-xe2