From: jiajia <jia...@16...> - 2009-05-13 11:25:21
|
Hi, Actually, I try this: my .cc is: int main(int argc, char *argv[]) { parse_args(argc,argv); using namespace PlayerCc; PlayerClient* robot[popsize]; Position2dProxy* pp[popsize]; LaserProxy* lp[popsize]; for(int i=0;i<popsize;i++) { robot[i] =new PlayerClient("localhost", 6665+i); pp[i] = new Position2dProxy(robot[i], 1); lp[i] = new LaserProxy(robot[i], 0); pp[i].SetMotorEnable (true); } robot[0].read(); ......... } Everything has the same problem. for robot, it says : The request to 'read' is in ' robot[0]', but 'robot[0]' is not a class type of 'PlayerCc::PlayerClient*’. for pp, it says: The request to 'SetMotorEnable' is in ' pp[i]', but 'pp[i]' is not a class type of 'PlayerCc::Position2dProxy*’. something like the above. Thanks again! jiajia 在2009-05-13,jiajia <jia...@16...> 写道: Hi Toby, Thanks for your rely. After I try " PlayerClient * robot[popsze]; " instead of " PlayerClient robot[popsize]; ", the above error disappears. But, when I try to use " robot[0] .read", it says: error: The request to 'read' is in ' robot[0]', but 'robot[0]' is not a class type of 'PlayerCc::PlayerClient*’. (the error is not written in English, and I translated it as above.Maybe it is not clear. Sorry) Thanks for your time~ jiajia 在2009-05-13,"Toby Collett" <tco...@pl...> 写道: You are creating an array of robots and then assigning a robot pointer to an individual item. You probably want PlayerClient * robot[popsze]; 2009/5/13 jiajia <jia...@16...> dear my friends, Sorry to bother you~ I really want to establish a group of robots using "for" loop, but it doesn't work! My .cc is int main(int argc, char *argv[]) { parse_args(argc,argv); using namespace PlayerCc; PlayerClient robot[popsize]; for(int i=0;i<popsize;i++) { robot[i] =new PlayerClient("localhost", 6665+i); } } My .cfg and .world are right, for I previously use them to configure other programs. Errors are: **.cc: In function ‘int main(int, char**)’: **.cc:47: 错误: no match 为‘operator=’在‘robot[i] = (std::basic_string<char, std::char_traits<char>, std::allocator<char> >(((const char*)"localhost"), ((const std::allocator<char>&)((const std::allocator<char>*)(& std::allocator<char>())))), (((PlayerCc::PlayerClient*)operator new(64u)), (<statement>, <anonymous>)))’中 /usr/local/include/player-2.1/libplayerc++/playerclient.h:104: 附注: 备选为: PlayerCc::PlayerClient& PlayerCc::PlayerClient::operator=(const PlayerCc::PlayerClient&) Sorry for my poor C++. Waiting for rely. Thanks a million!!!! jiajia 穿越地震带 纪念汶川地震一周年 ------------------------------------------------------------------------------ The NEW KODAK i700 Series Scanners deliver under ANY circumstances! Your production scanning environment may not be a perfect world - but thanks to Kodak, there's a perfect scanner to get the job done! With the NEW KODAK i700 Series Scanner you'll get full speed at 300 dpi even with all image processing features enabled. http://p.sf.net/sfu/kodak-com _______________________________________________ Playerstage-users mailing list Pla...@li... https://lists.sourceforge.net/lists/listinfo/playerstage-users -- This email is intended for the addressee only and may contain privileged and/or confidential information 穿越地震带 纪念汶川地震一周年 |