Linker Error: For a defined method in C++

Discussion in 'C Programming' started by nkrisraj@gmail.com, Jan 11, 2006.

  1. Guest

    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.
    , Jan 11, 2006
    #1
    1. Advertising

  2. Guest

    Sorry, the error message is as shown below:
    ld: 0711-317 ERROR: Undefined symbol: .RateRec::getPeriodSize() const
    , Jan 11, 2006
    #2
    1. Advertising

  3. 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) <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.
    Keith Thompson, Jan 11, 2006
    #3
  4. 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
    Martin Ambuhl, Jan 11, 2006
    #4
  5. Chuck F. Guest

    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/>
    Chuck F., Jan 11, 2006
    #5
  6. 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
    David Resnick, Jan 12, 2006
    #6
  7. Nelu Guest

    On 2006-01-11, <> 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...)
    Nelu, Jan 12, 2006
    #7
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Arne Schmitz
    Replies:
    3
    Views:
    357
    E. Robert Tisdale
    Apr 16, 2004
  2. Michel Rosien
    Replies:
    3
    Views:
    3,960
    Rob Williscroft
    Sep 10, 2004
  3. Oodini
    Replies:
    1
    Views:
    1,766
    Keith Thompson
    Sep 27, 2005
  4. Replies:
    3
    Views:
    315
    Pete Becker
    Jan 11, 2006
  5. Ralph Doncaster

    can linker symbols be defined in C?

    Ralph Doncaster, Apr 28, 2014, in forum: C Programming
    Replies:
    16
    Views:
    134
    Ralph Doncaster
    Apr 30, 2014
Loading...

Share This Page