Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > C Programming > 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: .RateDetailRec::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
 
 
 
 
nkrisraj@gmail.com
Guest
Posts: n/a
 
      01-11-2006
Sorry, the error message is as shown below:
ld: 0711-317 ERROR: Undefined symbol: .RateRec::getPeriodSize() const

 
Reply With Quote
 
 
 
 
Keith Thompson
Guest
Posts: n/a
 
      01-11-2006
http://www.velocityreviews.com/forums/(E-Mail Removed) writes:
> I defined a simple method, getRecsize() inside one of the classes,
> Class RateRec as shown below.


comp.lang.c++ is down the hall, on the left, just past the water
cooler. Around here, C++ merely increments the value of C and yields
the previous unincremented value.

--
Keith Thompson (The_Other_Keith) (E-Mail Removed) <http://www.ghoti.net/~kst>
San Diego Supercomputer Center <*> <http://users.sdsc.edu/~kst>
We must do something. This is something. Therefore, we must do this.
 
Reply With Quote
 
Martin Ambuhl
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:

[etc.]

You want news:comp.lang.c++, not news:comp.lang.c
C++ and C are different languages
 
Reply With Quote
 
Chuck F.
Guest
Posts: n/a
 
      01-11-2006
(E-Mail Removed) wrote:
>
> I defined a simple method, getRecsize() inside one of the
> classes, Class RateRec as shown below.
>
> class RateRec { public: size_t getRecSize(void) const; ......
>

.... snip ...

This has nothing to do with the C language. For C++, go out the
door, turn left, go 32 paces and enter the group labelled C++ on
the right.

--
"If you want to post a followup via groups.google.com, don't use
the broken "Reply" link at the bottom of the article. Click on
"show options" at the top of the article, then click on the
"Reply" at the bottom of the article headers." - Keith Thompson
More details at: <http://cfaj.freeshell.org/google/>
 
Reply With Quote
 
David Resnick
Guest
Posts: n/a
 
      01-12-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: .RateDetailRec::getPeriodSize()
> const
>


While your problems are no doubt C++, it seems to me that
common sense might give an answer. You say that this is a
problem related to the getRecSize function and give code/etc
for that function. The linker says the problem related to
a different function called getPeriodSize. Hmmm. Perhaps it
is telling you something? But anyway, followups should be
in comp.lang.c++.

-David
 
Reply With Quote
 
Nelu
Guest
Posts: n/a
 
      01-12-2006
On 2006-01-11, (E-Mail Removed) <(E-Mail Removed)> wrote:
> Sorry, the error message is as shown below:
> ld: 0711-317 ERROR: Undefined symbol: .RateRec::getPeriodSize() const
>

Please quote.

--
Ioan - Ciprian Tandau
tandau _at_ freeshell _dot_ org (hope it's not too late)
(... and that it still works...)
 
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
can call a method, but not a method within a user-defined class aidy Ruby 5 06-04-2006 08:10 PM
object as a argument of the method in which the method is defined ? mike C++ 5 02-22-2006 01:24 PM
Linker Error: For a defined method() in C++ nkrisraj@gmail.com C++ 3 01-11-2006 10:31 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