Mailing list archive (omnetpp-l at omnetpp.org)


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Omnetpp-l] cannot cast cMessage to cPacket



Hello,

try to use cPacket * PK(cMessage  *) to cast cMessage to cPacket.

regards,
--
Ahmed




On Tue, Apr 7, 2009 at 10:42 AM, Vitali Anselm <VitaliAnselm at xxx> wrote:
Hello,

I use some functions like getByteLength() in my handleMessage(cMessage *msg)  function, so I decided to cast msg to cPacket to be able to use these functions. For this I wrote the following code:

cPacket *tempPtr = check_and_cast<cPacket *>(msg);

and then I use tempPtr at places, where the cPacket functions are called.

When I compile all, there is no errors, but when I want to run TKenv there is
 the following error:

 Error in module(.....):
 check_and_cast():cannot cast (cMessage*).......[0].per_second_timer to type
 "P7cPacket".

per_second_timer is declared as cMessage:

per_second_timer = new cMessage("per_second_timer");
       scheduleAt(simTime(), per_second_timer);

Can you help me?

regards,

Vitali
____________________________________________________________________
Psssst! Schon vom neuen WEB.DE MultiMessenger gehört?
Der kann`s mit allen: http://www.produkte.web.de/messenger/?did=3123

_______________________________________________
Omnetpp-l mailing list
Omnetpp-l at xxx
http://lists.omnetpp.org/mailman/listinfo/omnetpp-l

_______________________________________________
Omnetpp-l mailing list
Omnetpp-l at xxx
http://lists.omnetpp.org/mailman/listinfo/omnetpp-l

Home | Main Index | Thread Index