🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: borland.public.cppbuilder.nativeapi
26 messages
26 total messages Started by Jos� Wed, 26 Apr 2006 09:57
Linker error
#3814
Author: Jos�
Date: Wed, 26 Apr 2006 09:57
20 lines
1598 bytes
I'm having an unexpected problem

I few days ago Hans advised me to use the function SelectDirectory,
with the header filectrl.hpp. Well, that was fine.

Today another problem arose unexpectedly. It was a familiar one. My
program compiled and linked without problem but it crashed at the very
outset. I already knew the solution to this problem: Start a new
project, copy *.H, &.CPP and *.DFM, and the problem is solved.

But this time this procedure resulted in another nasty problem:

[Linker Error] Unresolved external '__fastcall
Filectrl::SelectDirectory(const System::AnsiString, const
System::WideString, System::AnsiString&)' 

This really drives me crazy. When I remove SelectDirectory, the
program runs, so starting a new project did remedy the crash problem.
-- 
Jos�
Re: Linker error
#3815
Author: Hans Galema
Date: Wed, 26 Apr 2006 12:57
25 lines
1882 bytes
Jos� wrote:

> Today another problem arose unexpectedly. It was a familiar one. My
> program compiled and linked without problem but it crashed at the very
> outset. I already knew the solution to this problem: Start a new
> project, copy *.H, &.CPP and *.DFM, and the problem is solved.

Which .cpp file is that ? The one that contains calls to SelectDirectory() ?

I assume that you have more units in the project so this solutions
looks terrible.

Did it crash as soon as you tried to run it ? Inside/oudside the IDE ?

It might help if you told which version of buider you use.

> But this time this procedure resulted in another nasty problem:
> 
> [Linker Error] Unresolved external '__fastcall
> Filectrl::SelectDirectory(const System::AnsiString, const
> System::WideString, System::AnsiString&)' 

Throw away the .tds file and all .o files and do a rebuild.

Hans.
Re: Linker error
#3816
Author: Remy Lebeau (TeamB)
Date: Wed, 26 Apr 2006 18:05
34 lines
2184 bytes
"Jos�" <jose@127.0.0.1> wrote in message
news:6jgu42lmnd7anrv89k6h8uevgnru3qshm2@4ax.com...

> But this time this procedure resulted in another nasty problem:

By default, the VCL's FileCtrl unit is not linked into an application,
because that particular unit is in the wrong VCL library file to begin with.
That is a long-standing problem on Borland's part.  In order to force that
unit to be linked into the application correctly, you have two choices:

1) drop a Win3.1 component onto a form, save the project, and then remove
the component.  The appropriate package references will remain in the
project.

2) edit the project BPR file directly to include the vclx package into the
projet manually.  The actual name of the package file depends on your
version of BCB:

    BCB 1 = ?
    BCB 3 = vclx35.bp*
    BCB 4 = vclx40.bp*
    BCB 5 = vclx50.bp*
    BCB 6 = vclx.bp*
    BDS 2006 = ? (I'll have to look that one up later)

The alternative is to not use SelectDirectory() at all.  Use the Win32 API
SHBrowseForFolder() function directly instead.  But then you have to deal
with other compiler errors if you are using BCB 5 or higher.  To fix those,
you have to add NO_WIN32_LEAN_AND_MEAN to the Conditionals list in the
Project Options dialog.


Gambit
Re: Linker error
#3817
Author: Jos�
Date: Thu, 27 Apr 2006 07:04
37 lines
2127 bytes
On Wed, 26 Apr 2006 14:57:09 +0200, Hans Galema <notused@notused.nl>
wrote in borland.public.cppbuilder.nativeapi:

>> Today another problem arose unexpectedly. It was a familiar one. My
>> program compiled and linked without problem but it crashed at the very
>> outset. I already knew the solution to this problem: Start a new
>> project, copy *.H, &.CPP and *.DFM, and the problem is solved.
>
>Which .cpp file is that ? The one that contains calls to SelectDirectory() ?

The very one

>I assume that you have more units in the project so this solutions
>looks terrible.

There is only one unit

>Did it crash as soon as you tried to run it ? Inside/oudside the IDE ?

Immediately when the program starts, before any window is displayed. I
cannot single step into the error.

>It might help if you told which version of buider you use.

4.0

>> But this time this procedure resulted in another nasty problem:
>> 
>> [Linker Error] Unresolved external '__fastcall
>> Filectrl::SelectDirectory(const System::AnsiString, const
>> System::WideString, System::AnsiString&)' 
>
>Throw away the .tds file and all .o files and do a rebuild.

Well, I restored a back-up of the crashing program 
-- 
Jos�
Re: Linker error
#3818
Author: Jos�
Date: Thu, 27 Apr 2006 07:10
27 lines
1819 bytes
On Wed, 26 Apr 2006 11:05:40 -0700, "Remy Lebeau \(TeamB\)"
<no.spam@no.spam.com> wrote in borland.public.cppbuilder.nativeapi:

>
>"Jos�" <jose@127.0.0.1> wrote in message
>news:6jgu42lmnd7anrv89k6h8uevgnru3qshm2@4ax.com...
>
>> But this time this procedure resulted in another nasty problem:
>
>In order to force that
>unit to be linked into the application correctly, you have two choices:
>
>1) drop a Win3.1 component onto a form, 
>
>2) edit the project BPR file directly t

I did neither before the problem arose, and without trouble. Your
solution may be fine, but the first time I used SelectDirectory() I
had no problem at all.

>The alternative is to not use SelectDirectory() at all.  Use the Win32 API
>SHBrowseForFolder() function directly instead.  

We discussed this before. I had lots of trouble using
SHBrowseForFolder(), while SelectDirectory() was quick and easy.
-- 
Jos�
Re: Linker error
#3819
Author: Remy Lebeau (TeamB)
Date: Thu, 27 Apr 2006 07:52
18 lines
1553 bytes
"Jos�" <jose@127.0.0.1> wrote in message
news:gar052pvee5ubqnv989tid8vcprkrku2tv@4ax.com...

> I did neither before the problem arose, and without trouble. Your
> solution may be fine, but the first time I used SelectDirectory() I
> had no problem at all.

For that to happen, you had to have done something in the project beforehand
that already caused the necessary changes to the project, and you just
didn't notice it until now.

> We discussed this before. I had lots of trouble using SHBrowseForFolder()

Such as?  It is a very easy function to use.


Gambit
Re: Linker error
#3820
Author: Hans Galema
Date: Thu, 27 Apr 2006 07:59
13 lines
1438 bytes
Remy Lebeau (TeamB) wrote:

> For that to happen, you had to have done something in the project beforehand
> that already caused the necessary changes to the project, and you just
> didn't notice it until now.

Not needed. When I start a new application with bcb5 then

#include <FileCtrl.hpp>

is all that has to be done.

Hans.
Re: Linker error
#3822
Author: Jos�
Date: Thu, 27 Apr 2006 11:53
19 lines
1883 bytes
On Thu, 27 Apr 2006 00:52:38 -0700, "Remy Lebeau \(TeamB\)"
<no.spam@no.spam.com> wrote in borland.public.cppbuilder.nativeapi:

>> We discussed this before. I had lots of trouble using SHBrowseForFolder()
>
>Such as?  It is a very easy function to use.

Sorry, my memory failed me a bit. Hans advised to use that function. I
could not find it in help files, and Regis advised me to look in 
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/shellcc/platform/shell/reference/functions/shbrowseforfolder.asp

This turned out to be pretty complicated, and in the meantime my
attention was drawn to the much easier function SelectDirectory, and I
could not be bothered about SHBrowseForFolder any more.

It could be that SHBrowseForFolder is easy to use, but its
documentation requires same patient reading.
-- 
Jos�
Re: Linker error
#3824
Author: JD
Date: Thu, 27 Apr 2006 12:55
40 lines
2071 bytes
Jos� <jose@127.0.0.1> wrote:
>
> [...] advised me to look in [...] This turned out to be
> pretty complicated,

You seem to be ignoring the archives. When I said that there
was at least one sample that was a component I wasn't kidding.

   http://tinyurl.com/mocny

If you click File | New | Unit and save the new unit and then
paste the sample, all you'd have to do is remove the component
specific stuff:

static inline void ValidCtrCheck(TBrowseForFolder *) 
{
    ...
}

and

namespace Browseforfolder 
{
    ...
}

Then to use it, include it's header and dynamically allocate it
just like another other component. Set it's Prompt, Caption,
InitialFolder and RetainSelection properties and use it's
Execute method just like any other dialog.

Note that since it's assigned an Owner, you don't need to
delete it. You can allocate it in the form's constructor
and forget about it until you need to use it.

It should take you 10 minutes tops. Just don't forget to add
NO_WIN32_LEAN_AND_MEAN as noted by Gambit.

~ JD
Re: Linker error
#3827
Author: Remy Lebeau (TeamB)
Date: Thu, 27 Apr 2006 17:11
18 lines
1549 bytes
"Hans Galema" <notused@notused.nl> wrote in message
news:44507adf$1@newsgroups.borland.com...

> Not needed. When I start a new application with bcb5 then
>
> #include <FileCtrl.hpp>
>
> is all that has to be done.

That is not the end-all solution.  Yes, the function is *declared* in that
file, so the compiler is happy.  But the function *code* is in the wrong
binary lib file which does not always get included into a project, so the
linker usually complains.  Hense my earlier suggestions for forcing the
required library to be included into the project.


Gambit
Re: Linker error
#3831
Author: Jos�
Date: Thu, 27 Apr 2006 18:49
15 lines
1526 bytes
On Thu, 27 Apr 2006 10:11:22 -0700, "Remy Lebeau \(TeamB\)"
<no.spam@no.spam.com> wrote in borland.public.cppbuilder.nativeapi:

>Yes, the function is *declared* in that
>file, so the compiler is happy.  But the function *code* is in the wrong
>binary lib file 

I think there is an upgrade suggestion here. A header should not only
contain a function declaration, but also the name of the library file,
so that the library is automatically included.

This is rather similar to including the entire function definition in
the header.
-- 
Jos�
Re: Linker error
#3832
Author: Hans Galema
Date: Thu, 27 Apr 2006 19:08
9 lines
1406 bytes
Remy Lebeau (TeamB) wrote:

> ...   But the function *code* is in the wrong
> binary lib file which does not always get included into a project, so the
> linker usually complains. 

Then the question is: 'when does it and when does it not ?'.

Hans.
Re: Linker error
#3833
Author: Hans Galema
Date: Thu, 27 Apr 2006 19:16
18 lines
1737 bytes
Jos� wrote:

> ... A header should not only
> contain a function declaration, but also the name of the library file,
> so that the library is automatically included.

No that is no good. And what syntax would you use?

The o. file or library, which contains the body for a function,
should only be added when the function is actually called.

> This is rather similar to including the entire function definition in
> the header.

Which is never done. Or do you refer to memberfunctions which
are completely in a class definition ?

Hans.
Re: Linker error
#3687
Author: Ed Mulroy
Date: Thu, 27 Apr 2006 20:55
18 lines
1801 bytes
No, it should not.  A header file is a compile time item.  It is not a link 
item.

C and C++ are professional development languages. The variety of uses for a 
professional language includes that where a user supplies a library of his 
choice. .

.  Ed

> Jos� wrote in message
>news:2f4252tilb6shc7alh7vec24s67pevef5l@4ax.com...
>
> I think there is an upgrade suggestion here. A header should
> not only contain a function declaration, but also the name of
> the library file, so that the library is automatically included.
>
> This is rather similar to including the entire function definition
> in the header.
Re: Linker error
#3688
Author: Jos�
Date: Thu, 27 Apr 2006 21:11
24 lines
1574 bytes
On Wed, 26 Apr 2006 11:05:40 -0700, "Remy Lebeau \(TeamB\)"
<no.spam@no.spam.com> wrote in borland.public.cppbuilder.nativeapi:

>2) edit the project BPR file directly to include the vclx package into the
>projet manually.  The actual name of the package file depends on your
>version of BCB:
>
>    BCB 1 = ?
>    BCB 3 = vclx35.bp*
>    BCB 4 = vclx40.bp*
>    BCB 5 = vclx50.bp*
>    BCB 6 = vclx.bp*
>    BDS 2006 = ? (I'll have to look that one up later)

I am no sure how this is done. I tried:

Project | Options | tab Packages | Add | browse to
Borland\Cbuilder4\Lib\Release\Vclx40.Bpi. 

It says: Package can't be installed because another packae with the
same name is already loaded: C:\Windosw\system32\vclx40.bpl

-- 
Jos�
Re: Linker error
#3689
Author: Jos�
Date: Thu, 27 Apr 2006 21:15
17 lines
1450 bytes
On Wed, 26 Apr 2006 11:05:40 -0700, "Remy Lebeau \(TeamB\)"
<no.spam@no.spam.com> wrote in borland.public.cppbuilder.nativeapi:

>2) edit the project BPR file directly to include the vclx package into the
>projet manually.  The actual name of the package file depends on your
>version of BCB:

Hm, BPR happens to be an ASCII file. Of course that's what you meant.
It contains: 

PACKAGES = qrpt40.bpi vcldb40.bpi nmfast40.bpi ibsmp40.bpi
vcldbx40.bpi teeui40.bpi  vclsmp40.bpi teedb40.bpi tee40.bpi dss40.bpi
inetdb40.bpi inet40.bpi  vclmid40.bpi VCL40.bpi VCLX40.bpi 

Adding vclx40.bpl makes no difference.
-- 
Jos�
Re: Linker error
#3690
Author: Jos�
Date: Thu, 27 Apr 2006 21:18
14 lines
1549 bytes
On Thu, 27 Apr 2006 21:16:36 +0200, Hans Galema <notused@notused.nl>
wrote in borland.public.cppbuilder.nativeapi:

>> ... A header should not only
>> contain a function declaration, but also the name of the library file,
>> so that the library is automatically included.
>
>No that is no good. And what syntax would you use?

This hardly matters. A possible syntax would be:

Function name(parameters)[library name];
-- 
Jos�
Re: Linker error
#3691
Author: Jos�
Date: Thu, 27 Apr 2006 21:19
11 lines
1448 bytes
On Thu, 27 Apr 2006 16:55:48 -0400, "Ed Mulroy"
<dont_email_me@bitbuc.ket> wrote in
borland.public.cppbuilder.nativeapi:

>C and C++ are professional development languages. 

Which makes programming so hard, I think. I long for the time when I
programmed in Assembly, but this apears to be suitable for DOS
programs only.
-- 
Jos�
Re: Linker error
#3692
Author: Remy Lebeau (TeamB)
Date: Thu, 27 Apr 2006 21:34
11 lines
1136 bytes
"Jos�" <jose@127.0.0.1> wrote in message
news:jkc2521s7b6ffp5an43a10hnps2a0ddpuu@4ax.com...

> I am no sure how this is done.

As I said before, you have to edit the BPR file directly.  The IDE can't
help you on this issue.


Gambit
Re: Linker error
#3694
Author: Remy Lebeau (TeamB)
Date: Thu, 27 Apr 2006 21:38
15 lines
1301 bytes
"Jos�" <jose@127.0.0.1> wrote in message
news:t1d252h9ib68j7p2bgal2i004lsp0mdj1s@4ax.com...

> Hm, BPR happens to be an ASCII file.

Yes.  Which only makes it easier to edit by hand.

> Adding vclx40.bpl makes no difference.

You need to add vclx40.bpi, not vclx40.bpl.  You also should add vclx40.lib
to the LIBRARIES and SPARELIBS sections.


Gambit
Re: Linker error
#3698
Author: Jos�
Date: Fri, 28 Apr 2006 06:48
17 lines
1445 bytes
On Thu, 27 Apr 2006 14:38:15 -0700, "Remy Lebeau \(TeamB\)"
<no.spam@no.spam.com> wrote in borland.public.cppbuilder.nativeapi:

>> Hm, BPR happens to be an ASCII file.
>
>Yes.  Which only makes it easier to edit by hand.

Definitely. I never looked inside the file before.

>> Adding vclx40.bpl makes no difference.
>
>You need to add vclx40.bpi, not vclx40.bpl.  You also should add vclx40.lib
>to the LIBRARIES and SPARELIBS sections.

That's it. Thanks, Remy.
-- 
Jos�
Re: Linker error
#3699
Author: Ed Mulroy
Date: Fri, 28 Apr 2006 14:08
19 lines
2129 bytes
The same thing applies to programs written partially or entirely in 
assembly, including those for DOS.  If he wishes, the programmer should be 
able to supply his own libraries implemetation.  In the DOS days this was 
even more of a need as machines were not as standardized and it was common 
to supply custom versions of runtime library functions or of the runtime 
library itself to handle differences in customers' machines.

For 32 bit Windows very few programs are entirely written in assembly.  More 
often portions are written in assembly and most of it is written in a higher 
level language such as C or C++.

.  Ed

> Jos� wrote in message
> news:7ad2525vkqstuvar2jl7h5uj1atrgnnf2o@4ax.com...
>
> Which makes programming so hard, I think. I long for the time when I
> programmed in Assembly, but this apears to be suitable for DOS
> programs only.
Re: Linker error
#3701
Author: Jim Dodd
Date: Fri, 28 Apr 2006 15:42
21 lines
1872 bytes
Jos� wrote:
> On Thu, 27 Apr 2006 16:55:48 -0400, "Ed Mulroy"
> <dont_email_me@bitbuc.ket> wrote in
> borland.public.cppbuilder.nativeapi:
> 
>> C and C++ are professional development languages. 
> 
> Which makes programming so hard, I think. I long for the time when I
> programmed in Assembly, but this apears to be suitable for DOS
> programs only.

You may want to look at the Gibson Research Corporation "Small is
Beautiful" page:

http://www.grc.com/smgassembly.htm

There is also a list of other assembly language resources.

Regards,
Jim Dodd
Onset Computer Corp.
Re: Linker error
#3705
Author: Jos�
Date: Fri, 28 Apr 2006 17:49
14 lines
1624 bytes
On Fri, 28 Apr 2006 11:42:26 -0400, Jim Dodd <bcbuilderboy@yahoo.com>
wrote in borland.public.cppbuilder.nativeapi:

>You may want to look at the Gibson Research Corporation "Small is
>Beautiful" page:
>
>http://www.grc.com/smgassembly.htm
>
>There is also a list of other assembly language resources.

In the times of DOS I wrote a program in assembly. It was a 50 kB .COM
file. Rewritten with C++B it is 825 kB.
-- 
Jos�
Re: Linker error
#3708
Author: Jos�
Date: Fri, 28 Apr 2006 20:19
9 lines
1246 bytes
On 27 Apr 2006 05:55:45 -0700, "JD" <nospam@nospam.com> wrote in
borland.public.cppbuilder.nativeapi:

>Just don't forget to add
>NO_WIN32_LEAN_AND_MEAN as noted by Gambit.

Call me a dunce. How is this done?
-- 
Jos�
Re: Linker error
#3710
Author: Jos�
Date: Fri, 28 Apr 2006 20:29
18 lines
1576 bytes
On 27 Apr 2006 05:55:45 -0700, "JD" <nospam@nospam.com> wrote in
borland.public.cppbuilder.nativeapi:

>You seem to be ignoring the archives. When I said that there
>was at least one sample that was a component I wasn't kidding.
>
>   http://tinyurl.com/mocny

I tried that one. I don't see much difference with SelectDirectory().
They display the same window. I guess one function uses the other one.

>Just don't forget to add
>NO_WIN32_LEAN_AND_MEAN as noted by Gambit.

I did forget it, since I didn't know how to do it, and I had no
errors.
-- 
Jos�
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