2012-06-15 35 views
0

我在SENSE SIMULATOR中運行我的代碼時遇到了下面提到的2種錯誤。 的錯誤是如下 -錯誤:類型'int'和'<無法解析的重載函數類型>'到二進制'操作符'的操作數無效

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: 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 ‘&’ ?)`

此錯誤來了在本部分中:

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種錯誤的文件....

誰能好心幫我,爲什麼這2個錯誤當這個相同的文件與舊的感覺版本完美地運行時奇怪地出現。

問候,

Sougata

+1

向我們展示'SensorSim','StopTime','PacketSize'等 – dirkgently

回答

2

聽起來像StopTime是一個函數。這將解釋這兩個錯誤。

相關問題