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

Discussion in 'C++' 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: .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.
    , Jan 11, 2006
    #1
    1. Advertising

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

  3. Luke Meyers Guest

    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
    Luke Meyers, Jan 11, 2006
    #3
  4. Pete Becker Guest

    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)
    Pete Becker, Jan 11, 2006
    #4
    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,956
    Rob Williscroft
    Sep 10, 2004
  3. Oodini
    Replies:
    1
    Views:
    1,762
    Keith Thompson
    Sep 27, 2005
  4. Replies:
    6
    Views:
    346
  5. Ralph Doncaster

    can linker symbols be defined in C?

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

Share This Page