Linker Error: For a defined method in C++

N

nkrisraj

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.
 
N

nkrisraj

Sorry, the error message is as shown below:
ld: 0711-317 ERROR: Undefined symbol: .RateRec::getPeriodSize() const
 
K

Keith Thompson

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.
 
M

Martin Ambuhl

Hi,

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

class RateRec
{
public:
[etc.]

You want not C++ and C are different languages
 
C

Chuck F.

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/>
 
D

David Resnick

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,731
Messages
2,569,432
Members
44,835
Latest member
KetoRushACVBuy

Latest Threads

Top