🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: borland.public.cppbuilder.migration
4 messages
4 total messages Started by Michael Corby Wed, 02 Jul 2008 17:37
C++ Builer 2007 problem
#126
Author: Michael Corby
Date: Wed, 02 Jul 2008 17:37
25 lines
1673 bytes
Hello

The line below compiles ok in BDS 2006 under Windows XP.
However in C++ Builder 2007 under Vista is it shown as a linker error.

static_cast<TDBEdit*>(fName->Components[n])->ReadOnly = false;

[ILINK32 Error] Error: Unresolved external '__fastcall 
Dbctrls::TDBEdit::SetReadOnly(bool)'
referenced from C:\USERS\PUBLIC\DOCUMENTS\RAD 
STUDIO\PROJECTS\DLLFILES\DEBUG_BUILD\DLLFORM.OBJ


Associated lines as follows:-

void __declspec(dllexport)  EnabledTrueReadOnlyFalse(TForm *fName)
{
 int compCount = fName->ComponentCount;
 for (int n=0; n<compCount; n++)
}


Help required please.

Michael Corby 
Re: C++ Builer 2007 problem
#127
Author: Leo Siefert
Date: Thu, 03 Jul 2008 11:38
53 lines
2992 bytes
Michael Corby wrote:

>static_cast<TDBEdit*>(fName->Components[n])->ReadOnly = false;
>
>[ILINK32 Error] Error: Unresolved external '__fastcall 
>Dbctrls::TDBEdit::SetReadOnly(bool)'
>referenced from C:\USERS\PUBLIC\DOCUMENTS\RAD 
>STUDIO\PROJECTS\DLLFILES\DEBUG_BUILD\DLLFORM.OBJ

The fact that you have a linker error shows that your code has been
compiled without errors. 

The linker error indicates that it is unable to locate the VCL library
module containing the code for the DBEdit control. 

If you have imported the project from an earlier version of C++
builder you should check the imported library paths to make sure that
they are correct.

If this happens in a new project, then either you have overridden the
default settings of the IDE or the install is bad.

I tested the type of code you are using in a simple project by
dropping a TDBEdit control on the form and adding an OnClick handler
with this code:

void __fastcall TForm3::DBEdit1Click(TObject *Sender)
{
	static_cast<TDBEdit*>(Sender)->ReadOnly = false;
}

The project builds correctly.

You could try doing the same in your copy of C++ Builder 2007. If that
works (if it links with no errors) then you know that the problem is
somewhere in the project file for the project that does not work. If
that fails, then I suggest that you either uninstall and reinstall C++
Builder or perform a repair install to try to correct the problem.

If the problem is in your project settings, you can compare the paths
and the list of runtime packages in the project options dialog for
your old project against those in the one that works. Or, you can just
create a new project and add to it the files from your old project.

BTW - it is safer (but slower) to use a dynamic_cast<> than a
static_cast<> in situations like this unless you are certain that your
code ensures that only TDBEdit pointers can be contained in the array.
If only TDBEdit pointers can be in the array, then it would be cleaner
and more transparent to declare it as an array of TDBEdit pointers and
avoid the cast altogether. A cast is often a sign that your code can
be improved.

 - Leo
Re: C++ Builer 2007 problem
#128
Author: Michael Corby
Date: Sat, 05 Jul 2008 10:46
73 lines
4077 bytes
I have put the entire code which incorporates the "TDBEedit" line into a new 
VCL FORMS
project as you suggested and it builds correctly. However when I put the 
same code
into a new DLL project it gives the linker error.
It also gives the same error for TDBComboBox, TDBLookupComboBox and 
TDBRadioGroup.
"#include <DBCtrls.hpp>" line is included.

This is one of a number of DLLs I wrote which incorporate generic data entry 
and
other routines and I have being using these without problems in various 
projects
for a number of years.

Michael Corby

"Leo Siefert" <lIHATESPAMsiefert@senate.michigan.gov> wrote in message 
news:egdp64pkvj2ufp2cj6uuj92530sfdoe3qk@4ax.com...
> Michael Corby wrote:
>
>>static_cast<TDBEdit*>(fName->Components[n])->ReadOnly = false;
>>
>>[ILINK32 Error] Error: Unresolved external '__fastcall
>>Dbctrls::TDBEdit::SetReadOnly(bool)'
>>referenced from C:\USERS\PUBLIC\DOCUMENTS\RAD
>>STUDIO\PROJECTS\DLLFILES\DEBUG_BUILD\DLLFORM.OBJ
>
> The fact that you have a linker error shows that your code has been
> compiled without errors.
>
> The linker error indicates that it is unable to locate the VCL library
> module containing the code for the DBEdit control.
>
> If you have imported the project from an earlier version of C++
> builder you should check the imported library paths to make sure that
> they are correct.
>
> If this happens in a new project, then either you have overridden the
> default settings of the IDE or the install is bad.
>
> I tested the type of code you are using in a simple project by
> dropping a TDBEdit control on the form and adding an OnClick handler
> with this code:
>
> void __fastcall TForm3::DBEdit1Click(TObject *Sender)
> {
> static_cast<TDBEdit*>(Sender)->ReadOnly = false;
> }
>
> The project builds correctly.
>
> You could try doing the same in your copy of C++ Builder 2007. If that
> works (if it links with no errors) then you know that the problem is
> somewhere in the project file for the project that does not work. If
> that fails, then I suggest that you either uninstall and reinstall C++
> Builder or perform a repair install to try to correct the problem.
>
> If the problem is in your project settings, you can compare the paths
> and the list of runtime packages in the project options dialog for
> your old project against those in the one that works. Or, you can just
> create a new project and add to it the files from your old project.
>
> BTW - it is safer (but slower) to use a dynamic_cast<> than a
> static_cast<> in situations like this unless you are certain that your
> code ensures that only TDBEdit pointers can be contained in the array.
> If only TDBEdit pointers can be in the array, then it would be cleaner
> and more transparent to declare it as an array of TDBEdit pointers and
> avoid the cast altogether. A cast is often a sign that your code can
> be improved.
>
> - Leo 
Re: C++ Builer 2007 problem
#138
Author: Michael Corby
Date: Wed, 09 Jul 2008 08:52
80 lines
4364 bytes
Solved the problem by adding vcldb.lib to the dll project.

Michael Corby

"Michael Corby" <mcorby@indigo.ie> wrote in message 
news:486f50fa@newsgroups.borland.com...
>
> I have put the entire code which incorporates the "TDBEedit" line into a 
> new VCL FORMS
> project as you suggested and it builds correctly. However when I put the 
> same code
> into a new DLL project it gives the linker error.
> It also gives the same error for TDBComboBox, TDBLookupComboBox and 
> TDBRadioGroup.
> "#include <DBCtrls.hpp>" line is included.
>
> This is one of a number of DLLs I wrote which incorporate generic data 
> entry and
> other routines and I have being using these without problems in various 
> projects
> for a number of years.
>
> Michael Corby
>
> "Leo Siefert" <lIHATESPAMsiefert@senate.michigan.gov> wrote in message 
> news:egdp64pkvj2ufp2cj6uuj92530sfdoe3qk@4ax.com...
>> Michael Corby wrote:
>>
>>>static_cast<TDBEdit*>(fName->Components[n])->ReadOnly = false;
>>>
>>>[ILINK32 Error] Error: Unresolved external '__fastcall
>>>Dbctrls::TDBEdit::SetReadOnly(bool)'
>>>referenced from C:\USERS\PUBLIC\DOCUMENTS\RAD
>>>STUDIO\PROJECTS\DLLFILES\DEBUG_BUILD\DLLFORM.OBJ
>>
>> The fact that you have a linker error shows that your code has been
>> compiled without errors.
>>
>> The linker error indicates that it is unable to locate the VCL library
>> module containing the code for the DBEdit control.
>>
>> If you have imported the project from an earlier version of C++
>> builder you should check the imported library paths to make sure that
>> they are correct.
>>
>> If this happens in a new project, then either you have overridden the
>> default settings of the IDE or the install is bad.
>>
>> I tested the type of code you are using in a simple project by
>> dropping a TDBEdit control on the form and adding an OnClick handler
>> with this code:
>>
>> void __fastcall TForm3::DBEdit1Click(TObject *Sender)
>> {
>> static_cast<TDBEdit*>(Sender)->ReadOnly = false;
>> }
>>
>> The project builds correctly.
>>
>> You could try doing the same in your copy of C++ Builder 2007. If that
>> works (if it links with no errors) then you know that the problem is
>> somewhere in the project file for the project that does not work. If
>> that fails, then I suggest that you either uninstall and reinstall C++
>> Builder or perform a repair install to try to correct the problem.
>>
>> If the problem is in your project settings, you can compare the paths
>> and the list of runtime packages in the project options dialog for
>> your old project against those in the one that works. Or, you can just
>> create a new project and add to it the files from your old project.
>>
>> BTW - it is safer (but slower) to use a dynamic_cast<> than a
>> static_cast<> in situations like this unless you are certain that your
>> code ensures that only TDBEdit pointers can be contained in the array.
>> If only TDBEdit pointers can be in the array, then it would be cleaner
>> and more transparent to declare it as an array of TDBEdit pointers and
>> avoid the cast altogether. A cast is often a sign that your code can
>> be improved.
>>
>> - Leo
> 
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads