【发布时间】:2016-04-20 09:02:25
【问题描述】:
我创建了一个 *.bpl 项目 BPL_A,其中包含一个 TForm 子类,例如 TForm_Sub。
头文件Form_Sub.h如下:
class PACKAGE TForm_Sub : public TForm
{
...
};
extern PACKAGE TForm_Sub* Form_Sub;
源文件Form_Sub.cpp如下:
TForm_Sub* Form_Sub;
__fastcall TForm_Sub::TForm_Sub( TComponent* Owner )
{
...
}
我创建另一个 *.bpl 项目 BPL_B 来动态创建 TForm_Sub 实例。
class PACKAGE SomeClass
{
public:
TForm* CreateUI( const AnsiString& name );
};
#include "Form_Sub.h"
TForm* SomeClass::CreateUI( const AnsiString& name )
{
if( name == xxx )
{
if( Form_Sub != NULL )
{
Form_Sub = new TForm_Sub( owner );
}
return Form_Sub;
}
}
我将 BPL_A.bpi 添加到 BPL_B 的 Requires 部分。但是,在构建 BPL_B 时出现以下链接错误。
[ILINK32 错误] 错误:在模块 xxx.OBJ 中导出 SomeClass::CreateUI() 引用单元 BPL_A]Form_Sub 中的 __fastcall TForm_Sub::TForm_Sub()。
我不知道缺少什么。
【问题讨论】:
标签: linker-errors c++builder bpl