 |
BorlandTalk.com Borland discussion newsgroups
|
| View previous topic :: View next topic |
| Author |
Message |
Gord Guest
|
Posted: Wed Mar 21, 2007 12:06 am Post subject: Linking component problem |
|
|
I have been upgrading my BCB4 project to BDS2006. Part of that involves
installing an old delphi component (TPagePrinter). But I need it in the
meantime. I finally got it to show up on both palettes, dealt with
designintf ..., and dealt with the duplicate resource error and a bunch of
other errors that a lot of others seemed to encounter as well (thanks to all
who have helped previous posters). But I am stumped right now.
I am getting unresolved external errors. I have googled and read through a
ton of messages on the topic but I am unable to move past this.
[Linker Error] Error: Unresolved external '__fastcall
Graphics::TFont::SetSize(int)' referenced from C:\PROGRAM
FILES\BORLAND\BDS\4.0\COMPONENTS\PAGEPRNT.OBJ
[Linker Error] Error: Unresolved external 'System::__linkproc__ __fastcall
LStrLAsg()' referenced from C:\PROGRAM
FILES\BORLAND\BDS\4.0\COMPONENTS\PAGEPRNT.OBJ
[Linker Error] Error: Unresolved external 'System::__linkproc__ __fastcall
LStrAddRef()' referenced from C:\PROGRAM
FILES\BORLAND\BDS\4.0\COMPONENTS\PAGEPRNT.OBJ
etc.
I get these errors even when I drop the component on a blank project form.
It works fine when I run a delphi project. But I need it to work on
C++Builder.
I tried adding vclx.lib to the project to no avail.
It seems like a path problem, but I am not sure which one and where to point
it.
Help would be appreciated. |
|
| Back to top |
|
 |
Craig Farrell Guest
|
Posted: Wed Mar 21, 2007 1:25 am Post subject: Re: Linking component problem |
|
|
Hi,
| Quote: | I get these errors even when I drop the component on a blank project form.
|
If you set ON the option to Show Command Line (Tools | Options)
do you see NO_STRICT being passed to the compiler?
| Quote: | I tried adding vclx.lib to the project to no avail.
|
You could try adding vcle.lib as well.
--Craig |
|
| Back to top |
|
 |
Craig Farrell Guest
|
Posted: Wed Mar 21, 2007 1:33 am Post subject: Re: Linking component problem |
|
|
| Quote: | installing an old delphi component (TPagePrinter). But I need it in the
Graphics::TFont::SetSize(int)' referenced from C:\PROGRAM
LStrLAsg()' referenced from C:\PROGRAM
LStrAddRef()' referenced from C:\PROGRAM
|
Does the pascal code for the component use those
functions? Does it have, in its 'uses' list, anything
that seems older like maybe old vcl sample components?
--Craig |
|
| Back to top |
|
 |
Gord Guest
|
Posted: Wed Mar 21, 2007 4:59 am Post subject: Re: Linking component problem |
|
|
| Quote: | If you set ON the option to Show Command Line (Tools | Options)
do you see NO_STRICT being passed to the compiler?
|
Thanks for responding Craig. Yes I do see NO_STRICT.
| Quote: | You could try adding vcle.lib as well.
|
Just tried that. No luck. |
|
| Back to top |
|
 |
Gord Guest
|
Posted: Wed Mar 21, 2007 6:12 am Post subject: Re: Linking component problem |
|
|
| Quote: | installing an old delphi component (TPagePrinter). But I need it in the
Graphics::TFont::SetSize(int)' referenced from C:\PROGRAM LStrLAsg()'
referenced from C:\PROGRAM LStrAddRef()' referenced from C:\PROGRAM
Does the pascal code for the component use those
functions? Does it have, in its 'uses' list, anything
that seems older like maybe old vcl sample components?
|
Well there are actually 43 of those unresolved external errors. I went
through the first 15. 2 of them were referenced in the pascal files, 13
weren't.
Here are the "uses" blocks from the 4 files:
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls,
Forms, Dialogs, Printers, ExtCtrls,
uses Windows, SysUtils, Classes, Graphics, Forms, Controls, StdCtrls,
Buttons, ExtCtrls;
uses Windows, SysUtils, Classes, Graphics, Forms, Controls, StdCtrls,
Buttons, ExtCtrls;
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
StdCtrls, DesignIntf, DesignEditors, TypInfo, PagePrnt;
Its actually the 1st and 3rd files that the linker references.
Any ideas? |
|
| Back to top |
|
 |
Gord Guest
|
Posted: Wed Mar 21, 2007 7:44 am Post subject: Re: Linking component problem |
|
|
| Quote: | Those 'uses' seem pretty standard. As an experiment,
do C++ projects that use the component link when not
using packages?
|
All I have to do to make it fail is do a new VCL Forms project. Add the
component, and build. If I do that in Delphi, it runs fine. In C++, it
gives me the errors.
| Quote: | Do your Pascal packages have chained dependencies?
The IDE should be pretty good about suggesting
"requires" items for packages during design time
of the package.
|
To build the package, all I am doing is opening up the dclusr.bdsproj file,
which is basically empty. I add the 4 pas files to the project. The dcr
file is there as well, although I can't remember if I added it or if the ide
added it. In addition to the rtl.dcp and vcl.dcp files in the Requires
group, I added the designide.dcp.
Do a Build. Install the dclusr100.bpl file by going to MyDocuments\Borland
Studio Projects\BPL\.
So it is pretty simple.
Once installed, add it to a blank form, compile and bingo.
| Quote: | Is this component available for download somewhere?
Is there a chance you can make a simlilarly failing
package that can be posted to .atachements group?
|
I have added the source files to the attachments group. The original
developer (Menees), open sourced it eons ago. |
|
| Back to top |
|
 |
Craig Farrell Guest
|
Posted: Wed Mar 21, 2007 7:57 am Post subject: Re: Linking component problem |
|
|
Hi,
| Quote: |
Yes I do see NO_STRICT.
|
Good, that suggests it is not due
to name mangling problems with things
like HDC parameters.
--Craig |
|
| Back to top |
|
 |
Craig Farrell Guest
|
Posted: Wed Mar 21, 2007 8:02 am Post subject: Re: Linking component problem |
|
|
Hi,
Those 'uses' seem pretty standard. As an experiment,
do C++ projects that use the component link when not
using packages?
Do your Pascal packages have chained dependencies?
The IDE should be pretty good about suggesting
"requires" items for packages during design time
of the package.
Is this component available for download somewhere?
Is there a chance you can make a simlilarly failing
package that can be posted to .atachements group?
--Craig |
|
| Back to top |
|
 |
Gord Guest
|
Posted: Wed Mar 21, 2007 8:11 am Post subject: Re: Linking component problem |
|
|
Craig,
I hope that my response to your questions is what you were looking for.
One interesting tidbit here. I find that when I delete the control from the
form, all the errors remain. |
|
| Back to top |
|
 |
Gord Guest
|
Posted: Wed Mar 21, 2007 8:11 am Post subject: Re: Linking component problem - working |
|
|
Okay, it is working, but it seems to be a strange fix.
I noticed that the obj files had not been updated since before I compiled
the component package under BDS2006. So I went to the linker output section
of the Project Options where I had previously selected "Generate All
C++Builder Files", and instead selected "Generate C++ Object files". The
result of this was that it created up to date obj files, but not a .bpl
file. So then I had to go back and re-select "Generate All C++Builder
Files" to create a .bpl file. Installed the new package. And it works.
When it says Generate ALL C++Builder files, I guess it doesn't really mean
all.
Why is this a two step operation?
Am I missing something here, should I have done it differently?
Thanks for your help Craig. |
|
| Back to top |
|
 |
David Dean [CodeGear] Guest
|
Posted: Thu Mar 22, 2007 12:58 am Post subject: Re: Linking component problem - working |
|
|
In article <4600cbaf (AT) newsgroups (DOT) borland.com>, "Gord" <dont (AT) spam (DOT) me>
wrote:
| Quote: | Am I missing something here, should I have done it differently?
|
You shouldn't need the .obj files any more. Everything is in the .lib
files.
--
-David Dean
CodeGear C++ QA Engineer
<http://blogs.codegear.com/ddean/> |
|
| Back to top |
|
 |
Craig Farrell Guest
|
Posted: Thu Mar 22, 2007 2:09 am Post subject: Re: Linking component problem - working |
|
|
Hi,
Thanks for sharing the resolution. Interesting
that old obj's are picked up first.
| Quote: | Why is this a two step operation?
|
Like David says, you do not need the obj's
because Generate all C++ files generates
static libraries, .lib files
The #pragma link "PagePrnt" must find the
obj first and use that so your step of creating
new obj's must have cleared up the use of old
obj's. But removing the .obj's altogether should
have cleared up the error too, as then the .lib
would be used to satisfy the link.
--Craig |
|
| Back to top |
|
 |
Gord Guest
|
Posted: Thu Mar 22, 2007 8:11 am Post subject: Re: Linking component problem - working properly |
|
|
Okay. I didn't have the "Designtime and Runtime" option selected under the
Usage Options of the Project Options for dclusr. (I noticed that it was
selected for the BCB4 package).
That cleans things up.
Thanks guys. |
|
| Back to top |
|
 |
Gord Guest
|
Posted: Thu Mar 22, 2007 8:11 am Post subject: Re: Linking component problem - working |
|
|
| Quote: | Like David says, you do not need the obj's
because Generate all C++ files generates
static libraries, .lib files
The #pragma link "PagePrnt" must find the
obj first and use that so your step of creating
new obj's must have cleared up the use of old
obj's. But removing the .obj's altogether should
have cleared up the error too, as then the .lib
would be used to satisfy the link.
|
I deleted the obj files. Then I got the error "[Linker Fatal Error] Fatal:
Unable to open file 'PAGEPRNT.OBJ' "
I found the dclusr.lib file in the BDS\4.0\LIB directory. The linker was
already pointed to it, which obviously wasn't enough. So I added it to the
project. It worked, the program ran.
I don't recall previously (in BCB4) having to add a lib file to the project.
Have things changed in this arena since BCB4?
The question I now have is: What are the ramifications of this for
deployment? Any? |
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|