0

I have been trying to create and send a control packet (reply) at a certain calculated time after processing the received request and i have a problem regarding to the code.

Here is a part of my code:

CBFREP *GPSR::createREP (CBFREQ *req)
{    
     CBFREP *repPkt = new CBFREP("CBFREP");
     repPkt->setPktType(REP);
     repPkt->setCreatorAdd(req->getCreatorAdd());
     ...........
      ........
     return repPkt;
}

void GPSR::processSelfMessage(cMessage *message)
{

    if (message == contentionTimer)
          CBFREP *rep = createREP(req); 

The code error is : undeclared identifier "req".

I am using instant veins-4.7.1

Dalia Adly
  • 53
  • 6
  • 1
    in the last line in your code, you passed **req** as a parameter, but i don't see where you declared it, maybe the problem is here, or maybe you need to provide more code enough to reproduce the error. – walid barakat Dec 29 '19 at 15:25
  • `req` is local name for the parameter passed to `createREP`, and does not exist in `processSelfMessage`. You need to pass a pointer to some other `CBFREQ` object. – 1201ProgramAlarm Dec 29 '19 at 15:25
  • Undeclared Identifier errors pop up when you don't declare something (variables/functions). In your code you haven't declared 'req' inside GPSR function. –  Dec 29 '19 at 15:26

0 Answers0