### Author Topic: error extending ServerConnectionListener  (Read 5891 times)

#### kot

• User
• Posts: 1
##### error extending ServerConnectionListener
« on: July 12, 2006, 06:56:47 PM »
Trying to extend ServerConnectionListener, as done in the HelloWorld example (and also referencing the Delta3d dtNet code), and I get an error trying to initialize boost's shared_ptr.

Code: [Select]
c:\delta3d\ext\inc\boost\shared_ptr.hpp(163): error C2439: 'boost::shared_ptr<T>::px' : member could not be initialized        with        [            T=GNE::ConnectionListener        ]c:\delta3d\ext\inc\boost\shared_ptr.hpp(163): error C2440: 'initializing' : cannot convert from 'epsilon::lib::util::ServerNetworkListener *const ' to 'GNE::ConnectionListener *'

the error is with (in getNewConnectionParams)

Code: [Select]
params.setListener( ServerNetworkListener::create( ) );

(also, I find that I have to fill in the param list for ::create() or it gives an error about create not taking 0 params)

The code for my class is exactly the same as in the HelloWorld example (except with different class name), and exhello compiles fine... I would guess a maybe a boost conflict between delta3d and gne, but Delta3d has a class that extends ServerConnectionListener, and it compiles without error

Just for reference,

Code: [Select]
typedef GNE::SmartPtr<ServerNetworkListener> sptr;typedef GNE::SmartPtr<ServerNetworkListener> wptr;static sptr create(int inRate, int outRate){ sptr ret( new ServerNetworkListener(inRate, outRate) ); ret->setThisPointer( ret ); return ret;}

and of course, i'm correctly extending, and the constructor is protected...I'm stumped, so any help would be great! Compiling with VS2003 by the way.

#### Gillius

• User
• Posts: 147
##### error extending ServerConnectionListener
« Reply #1 on: July 17, 2006, 11:18:37 PM »
I was on vacation out of the country last week, and now I'm back.

Looking at the error I see a * const in there but no const on the other side.  I'm having a bit of forgetfulness right now, if the const is after the * does it mean the pointer itself is const or the thing it points to?

But if that code you pasted is exactly as it is in your code, I don't see the method as being declared const, nor is ret const.

If the const is not the problem, the only other thing I would check is to make sure that the class actually extends ServerConnectionListener -- you can check to make sure it is public inheritance but I don't think that is a requirement there.

Otherwise, I wonder if there is something about the namespaces that is making VS2003 not allow the implicit cast?
Gillius
Gillius's Programming http://www.gillius.org/