14.04.2015, 15:45
Introduction
YSI uses A LOT of macros to make things easier to write. The downside to this is that it can make errors and warnings very hard to interpret as they will refer to code after macro replacement is done. This guide should help you to translate the given errors to the real errors.
I will add more as I become aware of them.
Errors and Warnings
1)
2)
3)
4)
5)
6)
7)
The above code WILL hang the compiler. On its own it is not a long line - very short relative to the 511 character maximum, but as stated earlier YSI uses a lot of macros and this expands to a long line of code (efficient, but long). The issue is intermediate stages - the code is expanded to very long code, then reduced to only slightly longer code. Try shortening the line.
That will compile fine. If the compiler still hangs (and you've confirmed which function is the problem by commenting out all others), then you may have to resort to using alternate methods such as basic "forward"/"public" timers. The code generated by "foreign" and "global" is so long that it had to be split in to two parts - hence why the two keywords were made to mirror "forward" and "public".
8)
You can, however, still have strings prefixed with "string:".
9)
10)
11)
12)
[pawn]#pragma semicolon 0
Then fix all the other errors that come up because they are missing so many semi-colons. Blame them, not me - this is what happens when you ignore community-wide standards!
13)
Should be:
14)
Somewhere in your code, or in one of the includes in your code, a file has been included incorrectly. ALL YSI files MUST be included using a backslash, NOT a forward slash. Change:
To:
Repeat for all other includes done wrong (i.e using "YSI/" not "YSI\").
YSI uses A LOT of macros to make things easier to write. The downside to this is that it can make errors and warnings very hard to interpret as they will refer to code after macro replacement is done. This guide should help you to translate the given errors to the real errors.
I will add more as I become aware of them.
Errors and Warnings
1)
- Code
pawn Код:
// Alternate:
//CMD:kickplayer(playerid, params[])
YCMD:kickplayer(playerid, params[], help) // Warning line.
{
// Some code here.
}
- Problem
Код:
<path>\errors.pwn(11) : warning 203: symbol is never used: "kickplayer" Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase 1 Warning.
- Solution
pawn Код:
#include <YSI\y_commands>
- Code
pawn Код:
timer X() // Error line.
{
}
- Problem
Код:
<path>\errors.pwn(3) : error 010: invalid function or declaration Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase 1 Error.
- Solution
pawn Код:
timer X[100]()
{
}
- Code
pawn Код:
X[100]() // Error line.
{
}
- Problem
Код:
<path>\errors.pwn(3) : error 010: invalid function or declaration Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase 1 Error.
- Solution
pawn Код:
timer X[100]()
{
}
- Code
pawn Код:
timer X[100](arr[]) // Error line.
{
}
- Problem
Код:
<path>\errors.pwn(3) : error 010: invalid function or declaration Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase 1 Error.
- Solution
pawn Код:
timer X[100](arr[], size)
{
}
pawn Код:
timer X[100](string:arr[])
{
}
- Code
pawn Код:
main()
{
new
Iterator:x<100>; // Warning line.
foreach (new i : x)
{
}
}
- Problem
Код:
<path>\errors.pwn(6) : warning 203: symbol is never used: "x@YSII_Cg" Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase 1 Warning.
- Solution
pawn Код:
main()
{
new
Iterator:x<100>;
Iter_Add(x, 10);
foreach (new i : x)
{
}
}
- Code
pawn Код:
main()
{
new
Iterator:x<100>;
Iter_Add(x, 10);
foreach (i : x) // Error line.
{
}
}
- Problem
Код:
<path>\errors.pwn(7) : error 017: undefined symbol "i" <path>\errors.pwn(7) : warning 206: redundant test: constant expression is non-zero <path>\errors.pwn(7) : error 017: undefined symbol "i" <path>\errors.pwn(7) : warning 221: label name "_Y_ITER_C0" shadows tag name <path>\errors.pwn(7) : warning 225: unreachable code <path>\errors.pwn(7) : error 017: undefined symbol "i" <path>\errors.pwn(7) : fatal error 107: too many error messages on one line Compilation aborted.Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase 4 Errors.
- Solution
pawn Код:
main()
{
new
Iterator:x<100>;
Iter_Add(x, 10);
foreach (new i : x)
{
}
}
- Problem
- Solution
pawn Код:
timer MyTimer[1000](playerid, string:str[], arr[], size, string:other[], string:final[])
{
}
pawn Код:
timer MyTimer[1000](p,string:s[],a[],c,string:o[],string:f[])
{
}
8)
- Code
pawn Код:
main()
{
inline Func(arr[]) // Error line.
{
}
}
- Problem
Код:
<path>\errors.pwn(7) : error 009: invalid array size (negative, zero or out of bounds) <path>\errors.pwn(7) : error 001: expected token: ")", but found ";" <path>\errors.pwn(7) : error 036: empty statement <path>\errors.pwn(7) : fatal error 107: too many error messages on one line Compilation aborted.Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase 4 Errors.
- Solution
Код:
<path>\errors.pwn(7) : warning 215: expression has no effect
pawn Код:
main()
{
inline Func(string:arr[])
{
}
}
- Code
pawn Код:
uvar
gFirst[MAX_PLAYERS][10], // Error line.
gSecond[MAX_PLAYERS][10];
- Problem
Код:
<path>\errors.pwn(9) : error 010: invalid function or declaration Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase 1 Error.
- Solution
pawn Код:
uvar gFirst[MAX_PLAYERS][10];
uvar gSecond[MAX_PLAYERS][10];
- Code
pawn Код:
public DoRead(name[], value[])
{
INI_String("key", gValue); // Error line.
}
- Problem
Код:
<path>\errors.pwn(12) : error 017: undefined symbol "INI_String" Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase 1 Error.
- Solution
pawn Код:
public DoRead(name[], value[])
{
INI_String("key", gValue, sizeof (gValue));
}
- Code
pawn Код:
#include <YSI\y_commands>
- Problem
Код:
<include>\YSI\y_debug.inc(367) : error 036: empty statement <include>\YSI\y_debug.inc(367) : error 036: empty statement <include>\YSI\y_amx.inc(367) : error 036: empty statement <include>\YSI\y_amx.inc(367) : error 036: empty statement <include>\YSI\y_amx.inc(411) : error 036: empty statement <include>\YSI\y_amx.inc(411) : error 036: empty statement <include>\YSI\y_amx.inc(646) : error 036: empty statement <include>\YSI\y_amx.inc(646) : error 036: empty statement <include>\YSI\y_amx.inc(780) : error 036: empty statement <include>\YSI\y_amx.inc(780) : error 036: empty statement <include>\YSI\y_amx.inc(938) : error 036: empty statement <include>\YSI\y_amx.inc(938) : error 036: empty statement <include>\YSI\y_amx.inc(958) : error 036: empty statement <include>\YSI\y_amx.inc(958) : error 036: empty statement <include>\YSI\internal\y_shortfunc.inc(144) : error 036: empty statement <include>\YSI\internal\y_shortfunc.inc(144) : error 036: empty statement <include>\YSI\internal\y_shortfunc.inc(150) : error 036: empty statement <include>\YSI\internal\y_shortfunc.inc(150) : error 036: empty statement <include>\YSI\internal\y_shortfunc.inc(159) : error 036: empty statement <include>\YSI\internal\y_shortfunc.inc(159) : error 036: empty statement <include>\YSI\internal\y_shortfunc.inc(174) : error 036: empty statement <include>\YSI\internal\y_shortfunc.inc(174) : error 036: empty statement <include>\YSI\internal\y_shortfunc.inc(183) : error 036: empty statement <include>\YSI\internal\y_shortfunc.inc(183) : error 036: empty statement <include>\YSI\internal\y_dohooks.inc(125) : error 036: empty statement <include>\YSI\internal\y_dohooks.inc(125) : error 036: empty statement Compilation aborted.Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase 26 Errors.
- Solution
Код:
-;+ -(+
- Code
pawn Код:
timer X[100]() // Error line.
{
}
- Problem
Код:
<path>\errors.pwn(3) : warning 218: old style prototypes used with optional semicolon Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase 1 Warning.
- Solution
[pawn]#pragma semicolon 0
Then fix all the other errors that come up because they are missing so many semi-colons. Blame them, not me - this is what happens when you ignore community-wide standards!
13)
- Code
pawn Код:
hook OnGameModeInit() // Error line.
{
}
- Problem
Код:
<path>\errors.pwn(3) : error 021: symbol already defined: "@yH_GameModeInit2" <path>\errors.pwn(3) : error 021: symbol already defined: "@yH_GameModeInit2" Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase 1 Warning.
- Solution
pawn Код:
#include <YSI\y_hooks>
#include <other>
hook OnGameModeInit() // Error line.
{
}
pawn Код:
#include <other>
#include <YSI\y_hooks>
hook OnGameModeInit() // Error line.
{
}
- Code
pawn Код:
#include "internal\y_version" // Error line.
- Problem
Код:
pawno\include\YSI/y_ini.inc(161) : fatal error 100: cannot read from file: "internal\y_version" Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase 1 Error.
- Solution
Код:
\YSI/y_ini.inc
pawn Код:
#include <YSI/y_ini>
pawn Код:
#include <YSI\y_ini>