错误:类型'int'和'<unresolved overloaded =“”function =“”type =“”>'to binary'operator /'</unresolved>的操作数无效

时间:2012-06-15 11:01:09

标签: c++ operator-overloading

我在SENSE SIMULATOR中运行此代码时遇到以下两种错误。 错误如下 -

  

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/’

出现此错误的行如下所示 -

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

第二种错误是

  

`sensim.cc:在函数'int main(int,char **)'中:

     

sensim.cc:189:20:错误:无效使用会员(你忘了'&amp;'   ?)

     

sensim.cc:201:46:错误:无效使用会员(你忘了'&amp;'   ?)

     

sensim.cc:215:57:错误:无效使用会员(你忘了'&amp;'   ?)`

此错误将在本节中出现:

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);

现在这个相同的文件与感知版本2.0运行完美,但是当我运行感知版本3.1的文件时,我得到了这两种错误....

任何人都可以帮助我,当这个相同的文件与旧版本的版本完美运行时,为什么这2个错误会变得奇怪。

问候,

Sougata

1 个答案:

答案 0 :(得分:2)

听起来StopTime是一个功能。这可以解释这两个错误。