Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > C++ > Linker Error: For a defined method() in C++

Reply
Thread Tools

Linker Error: For a defined method() in C++

 
 
nkrisraj@gmail.com
Guest
Posts: n/a
 
      01-11-2006
Hi,

I defined a simple method, getRecsize() inside one of the classes,
Class RateRec as shown below.

class RateRec
{
public:
size_t getRecSize(void) const;
......

private:
......

};

size_t RateRec::getRecSize(void) const
{
return( periods->size );

}

In this calls, I recently added a new method also. After these,
chnages, Iam able to compile this class correctly. And Iam able to
generate the library, libRateInfo.a, for some of the classes, in which
RateRec is also one of the classes.

I have some other main program. When I trying to link libRateInfo.a to
my main program, Iam getting the linker error related to getRecSize()
function as shown below.

ld: 0711-317 ERROR: Undefined symbol: .RateRec::getPeriodSize()
const

For me, this is a real crazy thing.
I was able to link this library before lot of times. That time, I
didn't get any linker error.

But now, Iam getting this linker error. Any hekp would be greatly
appreciated.

 
Reply With Quote
 
 
 
 
Victor Bazarov
Guest
Posts: n/a
 
      01-11-2006
http://www.velocityreviews.com/forums/(E-Mail Removed) wrote:
> [..]
> When I trying to link libRateInfo.a to
> my main program, Iam getting the linker error related to getRecSize()
> function as shown below.
>
> ld: 0711-317 ERROR: Undefined symbol: .RateRec::getPeriodSize()
> const
>
> For me, this is a real crazy thing.
> I was able to link this library before lot of times. That time, I
> didn't get any linker error.
>
> But now, Iam getting this linker error. Any hekp would be greatly
> appreciated.


Use some system-specific utility to verify that your library does in fact
contain the symbol you're trying to obtain from it. Beyond that, linking
and libraries are compiler- and platform-specific, and off-topic here.

V
 
Reply With Quote
 
 
 
 
Luke Meyers
Guest
Posts: n/a
 
      01-11-2006
(E-Mail Removed) wrote:
> Hi,
>
> I defined a simple method, getRecsize() inside one of the classes,
> Class RateRec as shown below.
>
> class RateRec
> {
> public:
> size_t getRecSize(void) const;
> ......
>
> private:
> ......
>
> };
>
> size_t RateRec::getRecSize(void) const
> {
> return( periods->size );
>
> }
>
> In this calls, I recently added a new method also. After these,
> chnages, Iam able to compile this class correctly. And Iam able to
> generate the library, libRateInfo.a, for some of the classes, in which
> RateRec is also one of the classes.
>
> I have some other main program. When I trying to link libRateInfo.a to
> my main program, Iam getting the linker error related to getRecSize()
> function as shown below.
>
> ld: 0711-317 ERROR: Undefined symbol: .RateRec::getPeriodSize()
> const


getPeriodSize? Did you define that, in addition to getRecSize? If
not, the solution is fairly obvious.

Luke

 
Reply With Quote
 
Pete Becker
Guest
Posts: n/a
 
      01-11-2006
(E-Mail Removed) wrote:
>
> I have some other main program. When I trying to link libRateInfo.a to
> my main program, Iam getting the linker error related to getRecSize()
> function as shown below.
>
> ld: 0711-317 ERROR: Undefined symbol: .RateRec::getPeriodSize()
> const
>


Be careful: the error is about RateRec::getPeriodSize, not about
RateRec::getRecSize.

--

Pete Becker
Dinkumware, Ltd. (http://www.dinkumware.com)
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
User-defined exception: "global name 'TestRunError' is not defined" jmike@alum.mit.edu Python 1 07-10-2008 12:37 PM
Using parenthesis with defined (#if defined(...)) Angel Tsankov C++ 1 04-05-2006 10:00 PM
Linker Error: For a defined method in C++ nkrisraj@gmail.com C Programming 6 01-12-2006 02:27 PM
#if (defined(__STDC__) && !defined(NO_PROTOTYPE)) || defined(__cplusplus) Oodini C Programming 1 09-27-2005 07:58 PM
What to do with a linker warning about a public symbol from the STL library defined in two modules? Michel Rosien C++ 3 09-10-2004 03:32 PM



Advertisments