stupid error

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • sieg1974

    stupid error

    Hi,

    this must be a stupid mistake, but I can't find it.
    When I try to link the following code:

    #include <iostream.h>
    #include "TestSK.hh"

    class Test_Impl : public POA_Test // , public PortableServer: :RefCountServan tBase
    {
    public:
    Test_Impl();
    ~Test_Impl();
    CORBA::Long getNumber();

    private:
    CORBA::Long theNumber;
    };

    Test_Impl::Test _Impl()
    {
    }

    CORBA::Long Test_Impl::getN umber()
    {
    return( theNumber );
    }

    int main( int argc, char ** argv )
    {
    cout << "hello world\n";
    return( 0 );
    }

    the linker returns these error messages

    ../main.o(.text+0x 8d): In function `Test_Impl::Tes t_Impl[in-charge]()':
    : undefined reference to `VTT for Test_Impl'
    ../main.o(.text+0x a4): In function `Test_Impl::Tes t_Impl[in-charge]()':
    : undefined reference to `VTT for Test_Impl'
    ../main.o(.text+0x bf): In function `Test_Impl::Tes t_Impl[in-charge]()':
    : undefined reference to `VTT for Test_Impl'
    ../main.o(.text+0x d6): In function `Test_Impl::Tes t_Impl[in-charge]()':
    : undefined reference to `vtable for Test_Impl'
    ../main.o(.text+0x e5): In function `Test_Impl::Tes t_Impl[in-charge]()':
    : undefined reference to `vtable for Test_Impl'
    ../main.o(.text+0x f5): In function `Test_Impl::Tes t_Impl[in-charge]()':
    : undefined reference to `vtable for Test_Impl'
    ../main.o(.text+0x 105): In function `Test_Impl::Tes t_Impl[in-charge]()':
    : undefined reference to `vtable for Test_Impl'
    ../main.o(.text+0x 118): In function `Test_Impl::Tes t_Impl[in-charge]()':
    : undefined reference to `VTT for Test_Impl'

    What could be wrong?

    Thanks a lot,

    Andre
  • Howard

    #2
    Re: stupid error


    "sieg1974" <sieg1974@yahoo .com> wrote in message
    news:897326d0.0 409071224.7092d c18@posting.goo gle.com...[color=blue]
    > Hi,
    >
    > this must be a stupid mistake, but I can't find it.
    > When I try to link the following code:
    >
    > #include <iostream.h>
    > #include "TestSK.hh"
    >
    > class Test_Impl : public POA_Test // , public[/color]
    PortableServer: :RefCountServan tBase[color=blue]
    > {
    > public:
    > Test_Impl();
    > ~Test_Impl();
    > CORBA::Long getNumber();
    >
    > private:
    > CORBA::Long theNumber;
    > };
    >
    > Test_Impl::Test _Impl()
    > {
    > }
    >
    > CORBA::Long Test_Impl::getN umber()
    > {
    > return( theNumber );
    > }
    >
    > int main( int argc, char ** argv )
    > {
    > cout << "hello world\n";
    > return( 0 );
    > }
    >
    > the linker returns these error messages
    >
    > ./main.o(.text+0x 8d): In function `Test_Impl::Tes t_Impl[in-charge]()':
    > : undefined reference to `VTT for Test_Impl'
    > ./main.o(.text+0x a4): In function `Test_Impl::Tes t_Impl[in-charge]()':
    > : undefined reference to `VTT for Test_Impl'
    > ./main.o(.text+0x bf): In function `Test_Impl::Tes t_Impl[in-charge]()':
    > : undefined reference to `VTT for Test_Impl'
    > ./main.o(.text+0x d6): In function `Test_Impl::Tes t_Impl[in-charge]()':
    > : undefined reference to `vtable for Test_Impl'
    > ./main.o(.text+0x e5): In function `Test_Impl::Tes t_Impl[in-charge]()':
    > : undefined reference to `vtable for Test_Impl'
    > ./main.o(.text+0x f5): In function `Test_Impl::Tes t_Impl[in-charge]()':
    > : undefined reference to `vtable for Test_Impl'
    > ./main.o(.text+0x 105): In function `Test_Impl::Tes t_Impl[in-charge]()':
    > : undefined reference to `vtable for Test_Impl'
    > ./main.o(.text+0x 118): In function `Test_Impl::Tes t_Impl[in-charge]()':
    > : undefined reference to `VTT for Test_Impl'
    >
    > What could be wrong?
    >
    > Thanks a lot,
    >
    > Andre[/color]

    Hard to say. You don't show what POA_Test looks like. Does it declare
    functions you haven't implemented? Also, where does the CORBA namespace
    come in? And where's your destructor implemented? It looks to me like
    something is not included in your link, but I can't tell from this what that
    might be. Is there an implementation for the TestSK.hh header file? Has it
    been compiled, and included as part of the link?

    Link problems are usually a matter of setup, specific to your platform, and
    are not considered C++ language issues (the subject of this newsgroup). But
    the answers to my questions *may* lead you to getting it to link properly.

    -Howard




    Comment

    • sieg1974

      #3
      Re: stupid error

      "Howard" <alicebt@hotmai l.com> wrote in message news:<32p%c.324 656$OB3.71659@b gtnsc05-news.ops.worldn et.att.net>...[color=blue]
      > "sieg1974" <sieg1974@yahoo .com> wrote in message
      > news:897326d0.0 409071224.7092d c18@posting.goo gle.com...[color=green]
      > > Hi,
      > >
      > > this must be a stupid mistake, but I can't find it.
      > > When I try to link the following code:
      > >
      > > #include <iostream.h>
      > > #include "TestSK.hh"
      > >
      > > class Test_Impl : public POA_Test // , public[/color]
      > PortableServer: :RefCountServan tBase[color=green]
      > > {
      > > public:
      > > Test_Impl();
      > > ~Test_Impl();
      > > CORBA::Long getNumber();
      > >
      > > private:
      > > CORBA::Long theNumber;
      > > };
      > >
      > > Test_Impl::Test _Impl()
      > > {
      > > }
      > >
      > > CORBA::Long Test_Impl::getN umber()
      > > {
      > > return( theNumber );
      > > }
      > >
      > > int main( int argc, char ** argv )
      > > {
      > > cout << "hello world\n";
      > > return( 0 );
      > > }
      > >
      > > the linker returns these error messages
      > >
      > > ./main.o(.text+0x 8d): In function `Test_Impl::Tes t_Impl[in-charge]()':
      > > : undefined reference to `VTT for Test_Impl'[/color]
      > ./main.o(.text+0x a4): In function `Test_Impl::Tes t_Impl[in-charge]()':[color=green]
      > > : undefined reference to `VTT for Test_Impl'[/color]
      > ./main.o(.text+0x bf): In function `Test_Impl::Tes t_Impl[in-charge]()':[color=green]
      > > : undefined reference to `VTT for Test_Impl'[/color]
      > ./main.o(.text+0x d6): In function `Test_Impl::Tes t_Impl[in-charge]()':[color=green]
      > > : undefined reference to `vtable for Test_Impl'[/color]
      > ./main.o(.text+0x e5): In function `Test_Impl::Tes t_Impl[in-charge]()':[color=green]
      > > : undefined reference to `vtable for Test_Impl'[/color]
      > ./main.o(.text+0x f5): In function `Test_Impl::Tes t_Impl[in-charge]()':[color=green]
      > > : undefined reference to `vtable for Test_Impl'[/color]
      > ./main.o(.text+0x 105): In function `Test_Impl::Tes t_Impl[in-charge]()':[color=green]
      > > : undefined reference to `vtable for Test_Impl'[/color]
      > ./main.o(.text+0x 118): In function `Test_Impl::Tes t_Impl[in-charge]()':[color=green]
      > > : undefined reference to `VTT for Test_Impl'
      > >
      > > What could be wrong?
      > >
      > > Thanks a lot,
      > >
      > > Andre[/color]
      >
      > Hard to say. You don't show what POA_Test looks like. Does it declare
      > functions you haven't implemented? Also, where does the CORBA namespace
      > come in? And where's your destructor implemented? It looks to me like
      > something is not included in your link, but I can't tell from this what that
      > might be. Is there an implementation for the TestSK.hh header file? Has it
      > been compiled, and included as part of the link?
      >
      > Link problems are usually a matter of setup, specific to your platform, and
      > are not considered C++ language issues (the subject of this newsgroup). But
      > the answers to my questions *may* lead you to getting it to link properly.
      >
      > -Howard[/color]


      I don't know why, but after I added the implementation od the
      destructor, the linker didn't complain anymore.
      The destructor code is just:

      Test_Impl::~Tes t_Impl()
      {
      }

      Andre

      Comment

      • Mike Wahler

        #4
        Re: stupid error

        "sieg1974" <sieg1974@yahoo .com> wrote in message
        news:897326d0.0 409071947.6d38b 2a9@posting.goo gle.com...[color=blue]
        >
        > I don't know why, but after I added the implementation od the
        > destructor, the linker didn't complain anymore.
        > The destructor code is just:
        >
        > Test_Impl::~Tes t_Impl()
        > {
        > }[/color]

        Well, that makes sense, since you had declared a destructor,
        but hadn't defined one.

        -Mike


        Comment

        Working...