我是delphi的新手。我试图在我的Delphi项目中添加C Object文件并直接链接它们,因为Delphi支持C Object Linking。当我链接单个对象文件时,我得到了它的工作。但是当我尝试链接多个对象文件时,出现'不满意的前向或外部声明'错误。我曾在Delphi 2007以及XE中试过这个。那么我在这里做错了什么?在Delphi 2007中链接多个C对象文件时出错
工作代码:
function a_function():Integer;cdecl;
implementation
{$Link 'a.obj'}
function a_function():Integer;cdecl;external;
end.
错误代码:
function a_function():Integer;cdecl;
function b_function();Integer;cdecl;
function c_function();Integer;cdecl;
implementation
{$LINK 'a.obj'}
{$LINK 'b.obj'}
{$LINK 'c.obj'}
function a_function():Integer;cdecl;external;
function b_function();Integer;cdecl;external;
function c_function();Integer;cdecl;external;
end.
我的猜测:在三个目标文件中找不到“b_function()”或“c_function()”。您认为该问题与链接多个对象文件有关,并且您证明您可以链接一个文件。您是否尝试过链接,例如,只有“b.obj”和只导入“b_function()”? – 2011-01-09 07:57:16
也许这篇文章由鲁迪Velthuis可以帮助: http://rvelthuis.de/articles/articles-cobjs.html – vcldeveloper 2011-01-09 08:06:24