| View previous topic :: View next topic |
| Author |
Message |
JD Guest
|
Posted: Sat Feb 14, 2004 1:46 pm Post subject: unresolved external |
|
|
I've subclassed the TInplaceEditList and I'm getting a linker error:
[Linker Error] Unresolved external '__fastcall Grids::TInplaceEditList::PaintWindow(void *)' referenced from C:...TESTTFEDITOR.OBJ
I haven't done anything to touch PaintWindow. What gives?
Notice that the error reads 'PaintWindow(void *)' and
the source (TInplaceEditList) reads 'PaintWindow(DC: HDC)'.
~ JD
|
|
| Back to top |
|
 |
OBones Guest
|
Posted: Sun Feb 15, 2004 11:43 pm Post subject: Re: unresolved external |
|
|
JD wrote:
| Quote: | I've subclassed the TInplaceEditList and I'm getting a linker error:
[Linker Error] Unresolved external '__fastcall Grids::TInplaceEditList::PaintWindow(void *)' referenced from C:...TESTTFEDITOR.OBJ
I haven't done anything to touch PaintWindow. What gives?
Notice that the error reads 'PaintWindow(void *)' and
the source (TInplaceEditList) reads 'PaintWindow(DC: HDC)'.
~ JD
That comes from an error in the generation of the header files from |
pascal files.
Unfortunately, you can't do much about it using only C++ code.
One solution would be to write your component directly in Delphi Pascal
Object.
|
|
| Back to top |
|
 |
JD Guest
|
Posted: Mon Feb 16, 2004 5:48 am Post subject: Re: unresolved external |
|
|
OBones <obones_fff_ (AT) meloo_fdf_ (DOT) com> wrote:
| Quote: | JD wrote:
I've subclassed the TInplaceEditList and I'm getting a linker error:
[Linker Error] Unresolved external '__fastcall Grids::TInplaceEditList::PaintWindow(void *)' referenced from C:...TESTTFEDITOR.OBJ
I haven't done anything to touch PaintWindow. What gives?
Notice that the error reads 'PaintWindow(void *)' and
the source (TInplaceEditList) reads 'PaintWindow(DC: HDC)'.
~ JD
That comes from an error in the generation of the header
files from pascal files.
|
How can I verify this? I found several posts where others have
subclassed the TInPlaceEdit using TInPlaceEditList and no
reports of my problem.
| Quote: | One solution would be to write your component directly in
Delphi Pascal Object.
|
Well Pascal was the first language that I ever learned so I
can work with it but I've never had a need to use Delphi in
CBuilder. I'll consider it only as a last resort.
~ JD
|
|
| Back to top |
|
 |
OBones Guest
|
Posted: Mon Feb 16, 2004 6:21 am Post subject: Re: unresolved external |
|
|
JD wrote:
| Quote: | OBones <obones_fff_ (AT) meloo_fdf_ (DOT) com> wrote:
JD wrote:
I've subclassed the TInplaceEditList and I'm getting a linker error:
[Linker Error] Unresolved external '__fastcall Grids::TInplaceEditList::PaintWindow(void *)' referenced from C:...TESTTFEDITOR.OBJ
I haven't done anything to touch PaintWindow. What gives?
Notice that the error reads 'PaintWindow(void *)' and
the source (TInplaceEditList) reads 'PaintWindow(DC: HDC)'.
~ JD
That comes from an error in the generation of the header
files from pascal files.
How can I verify this? I found several posts where others have
subclassed the TInPlaceEdit using TInPlaceEditList and no
reports of my problem.
That is certainly true, but did any of them override the PainWindow |
method? If yes, then they should have had the same problem as you.
To verify the problem, find the hpp file where PaintWindow is declared
(I'd say Grids.hpp) and look at the definition of the first parameter.
If I'm correct, it should be a void* (or something that resolves to a void*)
Now, if you open Grids.pas in the source directory, you'll see that
PaintWindow has a first parameter of type HDC.
The hpp file is generated from the pas file and you shouldn't modify it
under any circumstance.
It seems that HDC is output as a void* by the hpp generator, while HDC
actually simply is a long (32 bits) and is output as such in the obj
file. Thus the problem you get.
One solution may be to edit the hpp file and replace void* by long, but
I don't recommend doing this as this change will have to be done on
every installation of C++ Builder.
Another solution, a bit dirty, but more portable, would be to declare
your own TInplaceEditList class in a separate header file. This
declaration would be a complete copy of the one in Grids.hpp, but would
include the correction. You would have to include your own file instead
of grids.hpp but still use #pragma link "grids". This is the way I would
explore anyway.
| Quote: | Well Pascal was the first language that I ever learned so I
can work with it but I've never had a need to use Delphi in
CBuilder. I'll consider it only as a last resort.
And you should, I quite agree on that. |
|
|
| Back to top |
|
 |
JD Guest
|
Posted: Mon Feb 16, 2004 7:34 am Post subject: Re: unresolved external |
|
|
OBones <obones_fff_ (AT) meloo_fdf_ (DOT) com> wrote:
| Quote: | That is certainly true, but did any of them override the
PainWindow method? If yes, then they should have had the
same problem as you.
|
But I didn't override PaintWindow. That's what's so confusing.
| Quote: | [...] it should be a void* (or something that resolves to a
void*) Now, if you open Grids.pas in the source directory,
you'll see that PaintWindow has a first parameter of type HDC.
|
This is correct. However, HDC is a typedef for void* which
means that PaintWindow(HDC) and PaintWindow(void*) are
identical as far as the compiler is concerned.
I was able to get it to compile by overriding the PaintWindow(HDC):
void __fastcall TMyInPlaceEditList::PaintWindow(HDC DC)
{
inherited::PaintWindow(DC);
}
Everything seems to be ok now but I have so much code commented
out that it's too early to tell. Thanks for your time.
~ JD
|
|
| Back to top |
|
 |
OBones Guest
|
Posted: Mon Feb 16, 2004 10:58 pm Post subject: Re: unresolved external |
|
|
JD wrote:
| Quote: | I was able to get it to compile by overriding the PaintWindow(HDC):
void __fastcall TMyInPlaceEditList::PaintWindow(HDC DC)
{
inherited::PaintWindow(DC);
}
Everything seems to be ok now but I have so much code commented
out that it's too early to tell. Thanks for your time.
|
No worries
|
|
| Back to top |
|
 |
Craig Farrell Guest
|
Posted: Wed Feb 18, 2004 3:17 am Post subject: Re: unresolved external |
|
|
Hi,
| Quote: | I was able to get it to compile by overriding the PaintWindow(HDC):
void __fastcall TMyInPlaceEditList::PaintWindow(HDC DC)
{
inherited::PaintWindow(DC);
}
Everything seems to be ok now but I have so much code commented
out that it's too early to tell. Thanks for your time.
|
Pascal HDC and HWND parameters can be problematic on
the C++ side due to STRICT. I'm not sure what you changed but,
for reference, I think that another resolution would be to
change the HDC to unsigned in the dcc32 generated header.
--Craig
|
|
| Back to top |
|
 |
|