error: no matching function for call to
i want to use a method of anothre class in another one,but i get error below,whats the problem? TIA
error: no matching function 开发者_StackOverflow社区for call to ‘PositionInfo::PositionInfo()’
here is my code:
PositionInfo Pos;
double metr=Pos.GetBallDistToTeammate(5);
and PositionInfo.h class is:
PositionInfo(WorldState *pWorldState, InfoState *pInfoState);
and PositionInfo.cpp class is:
const double & GetBallDistToTeammate(Unum unum) const { Assert(unum > 0); return GetBallDistToPlayer(unum); }
Default constructor PositionInfo::PositionInfo() { /* code */}
is missing in your cpp file.
error: no matching function for call to ‘PositionInfo::PositionInfo()’
This seems like someone tries to call a default constructor for the class, but the compiler cannot find one.
精彩评论