Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > C++ > Compile error with virtual inheritance: const <anonymous>** - AGAIN

Reply
Thread Tools

Compile error with virtual inheritance: const <anonymous>** - AGAIN

 
 
Thomas Zangl
Guest
Posts: n/a
 
      01-14-2006
Hi!

First - thanks for your previous replies! After fixing the c'tor
everything went fine until ... I added one more class in the hierachie.

I have a class hierachie like this:

// interface, abstract only
class ISession {

}

// implements common parts of ISession
class Session: public virtual ISession {
public:
Session(Socket* conn);

}

// implements the rest of ISession
class P2PSession: public virtual Session {
public:
P2PSession(Socket* conn);
}

and I added one more class:

class P2PClient: public virtual P2PSession
{
public:
P2PClient(Socket* conn);
}

I get this error on compile:

g++ -c -g -Wall -O2 -I./include -o src/P2PClient.o src/P2PClient.cpp
src/P2PClient.cpp: In constructor `
FTPServer_:2PClient:2PClient(FTPServer_::Socke t*)':
src/P2PClient.cpp:10: error: no matching function for call to `
FTPServer_::Session::Session(const <anonymous>**)'
include/Session.h:10: error: candidates are:
FTPServer_::Session::Session(const
FTPServer_::Session&)
include/Session.h:12: error:
FTPServer_::Session::Session(FTPServer_::Socket*)
make: *** [src/P2PClient.o] Fehler 1

The c'tor of P2PSession:

//----------------------------------------------------------------------
P2PSession:2PSession(Socket* conn) : Session(conn)
{
}

The c'tor of P2PClient:
//----------------------------------------------------------------------
P2PClient:2PClient(Socket* conn): P2PSession(conn),
state_(CS_INIT_NEEDED)
{
}

Any ideas?

TIA,
--
----------------------------------------------------------------
,yours Thomas Zangl - http://www.velocityreviews.com/forums/(E-Mail Removed) - http://www.tzis.net/ -
- Freelancer - IT Consulting & Software Development -
Use Y.A.M.C! now! Get it at http://www.borg-kindberg.ac.at/yamc/
 
Reply With Quote
 
 
 
 
Thomas Zangl
Guest
Posts: n/a
 
      01-14-2006
Thomas Zangl wrote:

Hi!

> // implements the rest of ISession
> class P2PSession: public virtual Session {
> public:
> P2PSession(Socket* conn);
> }


Fixed it by removing "virtual" in the inhertiance of P2PSession from
Session.

I now tried to inherit P2PClient from the interface "INFSObserver" but
the linker gives me an error:

src/P2PClient.o(.text+0xed): In function
`FTPServer_:2PClient::~P2PClient [in-charge]()':
include/INFSObserver.h:12: undefined reference to `vtable for
FTPServer_::INFSObserver'
src/P2PClient.o(.text+0x13d): In function
`FTPServer_:2PClient::~P2PClient [in-charge deleting]()':
include/INFSObserver.h:12: undefined reference to `vtable for
FTPServer_::INFSObserver'
src/P2PClient.o(.gnu.linkonce.r._ZTIN10FTPServer_9P2PC lientE+0x1:include/ISession.h:28:
undefined reference to `typeinfo for FTPServer_::INFSObserver'
collect2: ld returned 1 exit status
make: *** [ftpserver] Fehler 1


INFSObserver.h is included in P2PClient.h

The inheritance looks like this now:

class P2PClient: public virtual P2PSession, public virtual INFSObserver
{
public:
......
}

Any ideas?

TIA
--
----------------------------------------------------------------
,yours Thomas Zangl - (E-Mail Removed) - http://www.tzis.net/ -
- Freelancer - IT Consulting & Software Development -
Use Y.A.M.C! now! Get it at http://www.borg-kindberg.ac.at/yamc/
 
Reply With Quote
 
 
 
 
Thomas Zangl
Guest
Posts: n/a
 
      01-14-2006
Thomas Zangl wrote:

Hi,

> // implements the rest of ISession
> class P2PSession: public virtual Session {
> public:
> P2PSession(Socket* conn);
> }


removed the "virtual" inheritance and everything works fine now!

Best regards,
--
----------------------------------------------------------------
,yours Thomas Zangl - (E-Mail Removed) - http://www.tzis.net/ -
- Freelancer - IT Consulting & Software Development -
Use Y.A.M.C! now! Get it at http://www.borg-kindberg.ac.at/yamc/
 
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
is const necessary in eg int compar(const void *, const void *) lovecreatesbeauty@gmail.c0m C Programming 26 11-10-2008 09:47 PM
const correctness - should C++ prefer const member over non-const? fungus C++ 13 10-31-2008 05:33 AM
const vector<A> vs vector<const A> vs const vector<const A> Javier C++ 2 09-04-2007 08:46 PM
Casting int'** to 'const int * const * const' dosn't work, why? Jonas.Holmsten@gmail.com C Programming 11 07-01-2007 06:16 PM
Compile error with virtual inheritance: const <anonymous>** Thomas Zangl C++ 11 01-13-2006 04:20 PM



Advertisments