🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.cppbuilder.oodesign
Article #60

Re: Weird problem with linker

#60
From: Francisco M. Marzoa
Date: Fri, 06 May 2005 11:31
78 lines
4093 bytes
Andrue Cope [TeamB] wrote:
> Francisco M. Marzoa wrote:
> 
> Forgive me if I'm misinterpreted your post but it seems to me that
> you're misunderstanding a basic principal of C/C++ development. I
> apologise profusely if this is the case.
> 
> 
>>Now, Tags is an instance of TTagList, defined on TagList.cpp. In the
>>includes of ReadAll.cpp I've put:
>>
>>#include "TagList.h"
>>
>>But this does not make the matter, as It compiles fine, but it does
>>not link later.
> 
> 
> Why do you think there is a relationship between #include and linker
> errors?

This is not the case, excuse me, my true problem is not C/C++, but my 
english:

What I want to show with this is that at least the function is really 
declared because the compiler do its work without errors. I think this 
information is interesting to find the source of the problem and its 
solution.

>>Method GetCount for TTagList is declared as:
>>
>>protected:
>>         int GetCount (void);
> 
> 
> Again, this is just a function declaration. What the linker is
> complaining about is that it can't find the function itself. You
> mention 'TagList.Cpp' - I would assume this contains the code for
> TTagList. Have you added this file to the project? If not then that
> will be the cause of the problem.

I've try also adding TagList.cpp and TagList.h to the project, even when 
they're in a directory that I've added to Include and Lib paths on 
project options, I've tried also moving them from its location to the 
Project's path where the file ReadAll.cpp resides with same problems.

> In 'C/C++' all #include does is tell the compiler to start reading from
> a different file. There is no explicit relationship between 'taglist.h'
> and 'taglist.cpp'. It's only common sense, convention and modern IDEs
> that lead programmers to name them that way. If 'taglist.cpp' isn't in
> your project then it might as well not exist as far as the
> compiler/linker are concerned.

They do really exists and the function is implemented. As I've told that 
TTagList class are also used from another project (not an application, 
but an VCL component) that I'm writting without these problems. This one 
compiles and links fine.

More on this:

I've been making some tests. One of them has been going to 
Project/Export Makefile on BCB IDE.

In a first attempt to run Borland's make from a command line (aka 
MS-DOS) window it gives me another error, something as "VCL.BPI not 
found". So I've edited the file adding $(BCB)\lib\Release to LIBPATH and 
this error pass. Then it gives me another error related to TagList, so 
I've added on OBJFILES TagList.obj and then all compiles and links ok 
creating a function .exe file. �?

Then, I've tried on the IDE Project/Edit option source and adding 
TagList.obj to OBJFILES, but it doesn't solve the matter. I've also 
added $(BCB)\lib\Release to 
Project/Options/Directories|Conditionals/Library path even when I think 
this is not required, but it didn't work neither.

�?

Thanks a million by your answer, of course.
Technical Details
Message-ID: <427b55a0@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!g2news1.google.com!news3.google.com!news.glorb.com!news-out.nntp.be!propagator2-sterling.newsfeeds.com!in.nntp.be!caladan.landsraad.net!newsgroups.borland.com!not-for-mail
References: <427b351e$1@newsgroups.borland.com> <427b4d14$1@newsgroups.borland.com>

Show Full Headers
Complete Article Headers
X-Google-Thread: 10db1e,44e310bfdda1fa37
X-Google-Attributes: gid10db1e,public
X-Google-Language: ENGLISH,ASCII
Date: Fri, 06 May 2005 13:31:45 +0200
From: "Francisco M. Marzoa" <fmmarzoa@softronica.org>
User-Agent: Mozilla Thunderbird 1.0 (Windows/20041206)
X-Accept-Language: en-us, en
MIME-Version: 1.0
Newsgroups: borland.public.cppbuilder.oodesign
Subject: Re: Weird problem with linker
References: <427b351e$1@newsgroups.borland.com> <427b4d14$1@newsgroups.borland.com>
In-Reply-To: <427b4d14$1@newsgroups.borland.com>
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 8bit
NNTP-Posting-Host: 213.4.20.55
Message-ID: <427b55a0@newsgroups.borland.com>
X-Trace: newsgroups.borland.com 1115379104 213.4.20.55 (6 May 2005 04:31:44 -0700)
Lines: 79
Path: arc1-ca.pugleaf.net!g2news1.google.com!news3.google.com!news.glorb.com!news-out.nntp.be!propagator2-sterling.newsfeeds.com!in.nntp.be!caladan.landsraad.net!newsgroups.borland.com!not-for-mail