Page 1 of 1

Can not link Derived TRectangleTool

Posted: Tue Jul 12, 2011 12:05 pm
by 16558319
Hi,

I've been attempting to do this over and over with no success. All I wanted to do is to derive a class form TRectangleTool. And I always get the link error:
[ILINK32 Error] Error: Unresolved external '__fastcall Teetools::TAnnotationTool::DrawTextW()' referenced from C:\DOCUMENTS AND SETTINGS\BENGST\MY DOCUMENTS\RAD STUDIO\PROJECTS\DEBUG\WIN32\UNIT1.OBJ

I'm using C++ XE Pro with TeeChrt 2011 Pro. I was getting "DrawTextA()" link error with earlier version!

What is the problem?

Please see the following simple code!

//---------------------------------------------------------------------------

#ifndef Unit1H
#define Unit1H
//---------------------------------------------------------------------------
#include <Classes.hpp>
#include <Controls.hpp>
#include <StdCtrls.hpp>
#include <Forms.hpp>
#include "Chart.hpp"
#include "TeEngine.hpp"
#include "TeeProcs.hpp"
#include "TeeTools.hpp"
#include <ExtCtrls.hpp>
//---------------------------------------------------------------------------
class TMyRectangleTool : public TRectangleTool
{
public: // User declarations
__fastcall TMyRectangleTool(TComponent* Owner);

};
//---------------------------------------------------------------------------
class TForm1 : public TForm
{
__published: // IDE-managed Components
TChart *Chart1;
TPanel *Panel1;
TRectangleTool *ChartTool1;
private: // User declarations
public: // User declarations
__fastcall TForm1(TComponent* Owner);
};
//---------------------------------------------------------------------------
extern PACKAGE TForm1 *Form1;
//---------------------------------------------------------------------------
#endif

//---------------------------------------------------------------------------

#include <vcl.h>
#pragma hdrstop

#include "Unit1.h"
//---------------------------------------------------------------------------
#pragma package(smart_init)
#pragma link "Chart"
#pragma link "TeEngine"
#pragma link "TeeProcs"
#pragma link "TeeTools"
#pragma resource "*.dfm"
TForm1 *Form1;
//---------------------------------------------------------------------------
__fastcall TMyRectangleTool::TMyRectangleTool(TComponent* Owner)
: TRectangleTool(Owner)

{

}
//---------------------------------------------------------------------------
__fastcall TForm1::TForm1(TComponent* Owner)
: TForm(Owner)
{
TMyRectangleTool * p = new TMyRectangleTool(Owner);
}
//---------------------------------------------------------------------------

Thanks

Re: Can not link Derived TRectangleTool

Posted: Wed Jul 13, 2011 11:09 am
by yeray
Hello Bill,

I could reproduce it. It sounds similar to this but it should be fixed with the newer versions.
Actually, the error I get references "DrawTextW" instead of "DrawTextA". I've searched in TeeChart sources and none of these functions are called anywhere.

On the other hand, I've seen that this works fine in Delphi. So, the only thing I can think right now is to try to make your derived class in Delphi and use it in your C++Builder project.

Code: Select all

unit MyRectangleTool;

interface

uses Classes, TeeTools;

type
  TMyRectangleTool = class(TRectangleTool)
  public
    constructor Create(AOwner: TComponent);
  end;

implementation

{ TMyRectangleTool }

constructor TMyRectangleTool.Create(AOwner: TComponent);
begin
  inherited;
end;

end.