Arash
Arash

Reputation: 3051

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

Upvotes: 2

Views: 3442

Answers (2)

Prince John Wesley
Prince John Wesley

Reputation: 63698

Default constructor PositionInfo::PositionInfo() { /* code */} is missing in your cpp file.

Upvotes: 2

Bo Persson
Bo Persson

Reputation: 92271

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.

Upvotes: 2

Related Questions