简体   繁体   中英

error: invalid operands of types ‘int’ and ‘<unresolved overloaded function type>’ to binary ‘operator/’

I am getting below mentioned 2 kinds of error while running my this code in SENSE SIMULATOR. The errors are as follows -

sensim.cc:137:23: error: invalid operands of types 'int' and '<unresolved overloaded function type>' to binary 'operator/'

sensim.cc:138:23: error: invalid operands of types 'int' and '<unresolved overloaded function type>' to binary 'operator/'

The lines where this error is coming looks like below -

 137. tp_sent = (sent / StopTime) * (PacketSize); // line 137
 138. tp_recv = (recv / StopTime) * (PacketSize); // line 138

And the second kind of error is

`sensim.cc: In function 'int main(int, char**)':

sensim.cc:189:20: error: invalid use of member (did you forget the '&' ?)

sensim.cc:201:46: error: invalid use of member (did you forget the '&' ?)

sensim.cc:215:57: error: invalid use of member (did you forget the '&' ?)`

This errors are coming in this section:

int main(int argc, char* argv[]){
SensorSim sim;
long int seed; // line 189 

sim.StopTime = 1000;
PRINT = 0;
ESCENARIO = 0; // line 201


// You can fix the seed to obtain the same results each time you simulate. If you set it to time(0) be aware that the same results will be obtained for short (less than 1 second) simulations
if(seed == 0) seed=time(0); 
                        // line 215 though this line is blank in my code
sim.Seed = seed; 

printf("StopTime: %.0f, Number of Nodes: %d, Area: %.0f by %.0f Seed %ld\n",
   sim.StopTime, sim.NumNodes, sim.MaxX, sim.MaxY, seed);
printf("Packet Size: %d, Interval: %f\n\n",
   PacketSize, Interval);

Now this same file is running perfectly with sense version 2.0 but when i am running the file with sense version 3.1 i am getting this 2 kinds of errors....

Can anyone kindly help me why this 2 errors are coming strangely when this same file is running perfectly with the older sense version.

Regards,

Sougata

Sounds like StopTime is a function. That would explain both errors.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM