open.mp forum
[Pawn] Incompatibility with the JunkBuster - Printable Version

+ open.mp forum (https://forum.open.mp)
-- Forum: SA-MP (https://forum.open.mp/forumdisplay.php?fid=3)
--- Forum: Pawn Scripting (https://forum.open.mp/forumdisplay.php?fid=10)
--- Thread: [Pawn] Incompatibility with the JunkBuster (/showthread.php?tid=1340)



Incompatibility with the JunkBuster - Ryder Sixz - 2020-11-11

Hello it's me again, I asked about error 25 when placing a new include, well the fact is that after trying many things, I found out that the problem is that being the JunkBuster include throws these 2 errors.?



Code:
\pawno\include\3DTryg.inc(1846) : error 025: function heading differs from prototype

\pawno\include\3DTryg.inc(1846) : error 021: symbol already defined: "JBC_GetPlayerSpeed"



If I remove the JunkBuster it compiles perfectly.



Is there a solution for this problem? the include I am trying to install is the 3DTryg to add new functions. Sorry for the inconvenience and thanks in advance.


RE: Incompatibility with the JunkBuster - Kwarde - 2020-11-12

I can't magically look into your computer and see what the exact code is. Anyway,



"error 025: function heading differs from prototype"

This means that a public function's arguments doesn't match it's arguments when it was forwarded. Eg.

Code:
forward myPublicFunction(Foo);

public myPublicFunction(Foo, Bar)

{

    return;

}

That would throw that error, for example.



"error 021: symbol already defined: "JBC_GetPlayerSpeed""

JBC_GetPlayerSpeed is already defined.


RE: Incompatibility with the JunkBuster - Ryder Sixz - 2020-11-12

(2020-11-12, 07:10 AM)Kwarde Wrote: I can't magically look into your computer and see what the exact code is. Anyway,



"error 025: function heading differs from prototype"

This means that a public function's arguments doesn't match it's arguments when it was forwarded. Eg.

Code:
forward myPublicFunction(Foo);

public myPublicFunction(Foo, Bar)

{

? ? return;

}

That would throw that error, for example.



"error 021: symbol already defined: "JBC_GetPlayerSpeed""

JBC_GetPlayerSpeed is already defined.



Sorry for not putting the code part, here it is.



Code:
Tryg3D::Function:: Float:GetPlayerSpeed(playerid){

new Float:x,Float:y,Float:z;

GetPlayerVelocity(playerid,x,y,z);

return floatmul(VectorSize(x,y,z),PLAYER_SPEED_MULTIPLIER);

}



So what would be the possible solution?



The problem is not really the code, it is that the include JunkBuster and the include 3DTryg cannot be in the same code because it throws the aforementioned errors. If you put them separately each one works well.



Edited: I already solved the problem by deleting the part of the 3DTryg include where it gave me an error, I think it was because that part was already defined in the JunkBuster include. Cheers


RE: Incompatibility with the JunkBuster - Kwarde - 2020-11-12

Quote:error 021: symbol already defined: "JBC_GetPlayerSpeed"
Quote:JBC_GetPlayerSpeed is already defined.
Quote:I think it was because that part was already defined in the JunkBuster include
What a good guess :P. That error means a symbol (eg. a function or variable) was already declared (created).

The "function heading differs from prototype" occured because they weren't declared in the same way in this case. This code would produce the same errors:
Code:
Foo(a)
{
    return a;
}

Foo(b)
{
    return b;
}

If you're using pawno and not vscode I suggest (strongly recommend) using vscode. You could've find out way earlier by opening your includes directory and searching for "JBC_GetPlayerSpeed".

Also make sure it's actually safe to remove it from that include. You should report that as an issue aswell (if it's on Github, submit an issue there).


RE: Incompatibility with the JunkBuster - Pinch - 2020-11-12

(2020-11-12, 12:15 PM)Ryder Sixz Wrote:
(2020-11-12, 07:10 AM)Kwarde Wrote: I can't magically look into your computer and see what the exact code is. Anyway,

"error 025: function heading differs from prototype"
This means that a public function's arguments doesn't match it's arguments when it was forwarded. Eg.
Code:
forward myPublicFunction(Foo);
public myPublicFunction(Foo, Bar)
{
? ? return;
}
That would throw that error, for example.

"error 021: symbol already defined: "JBC_GetPlayerSpeed""
JBC_GetPlayerSpeed is already defined.

Sorry for not putting the code part, here it is.

Code:
Tryg3D::Function:: Float:GetPlayerSpeed(playerid){
new Float:x,Float:y,Float:z;
GetPlayerVelocity(playerid,x,y,z);
return floatmul(VectorSize(x,y,z),PLAYER_SPEED_MULTIPLIER);
}

So what would be the possible solution?

The problem is not really the code, it is that the include JunkBuster and the include 3DTryg cannot be in the same code because it throws the aforementioned errors. If you put them separately each one works well.

Edited: I already solved the problem by deleting the part of the 3DTryg include where it gave me an error, I think it was because that part was already defined in the JunkBuster include. Cheers
And what did I tell in the previous thread? :)


RE: Incompatibility with the JunkBuster - Ryder Sixz - 2020-11-16

You gave me the idea bro c: