No Override found matching this argument

Started by Flockshot, Oct 27, 2014, 01:06 PM

Previous topic - Next topic

Flockshot

So I was making a class and am getting this error dont know what is the error.
Also dont know much about classes so.

Here is the Error.


Lines:




Can anyone tell me what is the error and how to solve it.

Thijn

To access functions not defined in your class ( Like CreateObject ) prefix them with ::.
Like so:
ped = ::CreateObject(6000,0,Vector(x.tofloat(), y.tofloat(), z.tofloat()),255);

.

Quick Tip: There's no need to create a vector object just to pass it as an argument. The function is overloaded to also accept three floating point values that form a position. Therefore you could pass those values directly.

Optimization Tip: Why do you call the tofloat() member function on each position variable? They'll get converted automatically so you don't have to make three function calls for nothing. Doing this on numerical values is a waste of instructions for the function call.

The error messages simply states that it couldn't find a function (overloaded or not) matching the arguments you provided. Basically you need to look at what arguments the function is expecting and what arguments are you passing.

There's also a possibility that the error isn't even coming from function call but rather from the vector constructor. So make sure to check that too.

One more thing that you could do is document on how the execution context works in Squirrel (as suggested by Thijn). I got fooled a couple of times by this my self by simply forgetting about it :D
.