|
|
#1 |
|
Beta Tester
![]() ![]() ![]() ![]() ![]() Join Date: Jun 2008
Location: 629
Posts: 13,301
Reputation: 1909
|
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)
pawn Code:
Code:
<path>\errors.pwn(11) : warning 203: symbol is never used: "kickplayer" Pawn compiler 3.2.3664 Copyright (c) 1997-2006, ITB CompuPhase 1 Warning.
You didn't include "YSI\y_commands". Commands are never explicitly called anywhere in code, so the compiler needs to be told that they will be called eventually. pawn Code:
2)
pawn Code:
Code:
<path>\errors.pwn(3) : error 010: invalid function or declaration Pawn compiler 3.2.3664 Copyright (c) 1997-2006, ITB CompuPhase 1 Error.
In this case the error message is fairly descriptive. It IS an invalid declaration - there is no delay specified for the timer. pawn Code:
3)
pawn Code:
Code:
<path>\errors.pwn(3) : error 010: invalid function or declaration Pawn compiler 3.2.3664 Copyright (c) 1997-2006, ITB CompuPhase 1 Error.
Very similar problem to the last one, only this time missing the "timer" keyword instead of the time. pawn Code:
4)
pawn Code:
Code:
<path>\errors.pwn(3) : error 010: invalid function or declaration Pawn compiler 3.2.3664 Copyright (c) 1997-2006, ITB CompuPhase 1 Error.
You have the syntax right with both "timer" and the time, but you STILL get an invalid declaration. This is actually another handy error telling you the truth. All arrays on "timer", "global" and "remotefunc" functions MUST be followed by their length. Strings do NOT need their length, but instead MUST be declared as "string:", otherwise the compiler can't tell the two apart. pawn Code:
pawn Code:
5)
pawn Code:
Code:
<path>\errors.pwn(6) : warning 203: symbol is never used: "x@YSII_Cg" Pawn compiler 3.2.3664 Copyright (c) 1997-2006, ITB CompuPhase 1 Warning.
This is one of the slightly more esoteric warning messages. Iterators compile to TWO variables - an array of data and a size. The data array is called "<name>@YSII_Ag", and the size variable is called "<name>@YSII_Cg". If you get a warning that the size variable is never used, it means the size is never modified, which means nothing is ever added to, or removed from the iterator. If this is the case then your iterator is always empty and thus pointless. If you get a message that "<name>@YSII_Ag" (the data array) is also never used, then the iterator is never used at all, even in a "foreach" loop. pawn Code:
6)
pawn Code:
Code:
<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 (c) 1997-2006, ITB CompuPhase 4 Errors.
Here only the first error is important, all the others are caused by the first one. They can be confusing as they expose some of the internals of "y_iterate", but just ignore them and fix the first error (same as ever). pawn Code:
7)
The compiler hangs.
There are a number of causes of this, commonly a macro expanding to too much code. If you have a "foreign", "global", "remotefunc" or "timer" declaration which is very big, like: pawn Code:
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. pawn Code:
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)
pawn Code:
Code:
<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 (c) 1997-2006, ITB CompuPhase 4 Errors.
This is actually a similar problem to number 4, but with different symptoms. Unfortunately inline functions cannot have arrays at all, even when followed by their size. If you do try include the size you will get an additional: Code:
<path>\errors.pwn(7) : warning 215: expression has no effect pawn Code:
9)
pawn Code:
Code:
<path>\errors.pwn(9) : error 010: invalid function or declaration Pawn compiler 3.2.3664 Copyright (c) 1997-2006, ITB CompuPhase 1 Error.
Variables declared with "new" or "stock" etc often follow the new line pattern above. For technical reasons this cannot be done with "uvar" and "svar" variables. Each one must be on the same line as a "uvar" or "svar" declaration. pawn Code:
10)
pawn Code:
Code:
<path>\errors.pwn(12) : error 017: undefined symbol "INI_String" Pawn compiler 3.2.3664 Copyright (c) 1997-2006, ITB CompuPhase 1 Error.
"INI_String" DOES exist, it just gives an unusual error when the last parameter is missed off. You must call it with the destination length. pawn Code:
11)
pawn Code:
Code:
<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 (c) 1997-2006, ITB CompuPhase 26 Errors.
When you get hundreds of errors like this inside YSI, it tends to be caused by using a non-standard editor (i.e. not PAWNO). There is nothing wrong with other editors, some are just set up with different default command line parameters for PAWNCC (the compiler). You need to make sure that you pass these two important switches: Code:
-;+ -(+
pawn Code:
Code:
<path>\errors.pwn(3) : warning 218: old style prototypes used with optional semicolon Pawn compiler 3.2.3664 Copyright (c) 1997-2006, ITB CompuPhase 1 Warning.
This seems to be caused by using Raven's RolePlay, who for some inexplicable reason decided to ignore standard SA:MP formatting and remove semi-colons. To fix this you first need to remove this line: pawn Code:
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)
pawn Code:
Code:
<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 (c) 1997-2006, ITB CompuPhase 1 Warning.
This applies to any callback hooked and and number on the end, for example "@yH_PlayerDisconnect42". The problem is caused by including y_hooks before other includes, as they may also use y_hooks: pawn Code:
Should be: pawn Code:
14)
pawn Code:
Code:
pawno\include\YSI/y_ini.inc(161) : fatal error 100: cannot read from file: "internal\y_version" Pawn compiler 3.2.3664 Copyright (c) 1997-2006, ITB CompuPhase 1 Error.
The true problem is here: Code:
\YSI/y_ini.inc pawn Code:
To: pawn Code:
Repeat for all other includes done wrong (i.e using "YSI/" not "YSI\"). Last edited by Y_Less; 28/05/2012 at 03:30 PM. |
|
|
|
|
|
#2 |
|
Huge Clucker
![]() ![]() ![]() Join Date: Oct 2011
Posts: 354
Reputation: 24
|
Very Useful thread man , thanks
|
|
|
|
|
|
#3 |
|
Big Clucker
![]() ![]() Join Date: Dec 2011
Location: Manila, Philippines
Posts: 152
Reputation: 27
|
Wow! I can finally fix my errors! Thank you!!!
|
|
|
|
|
|
#4 |
|
Beta Tester
![]() ![]() ![]() ![]() ![]() Join Date: Jun 2008
Location: 629
Posts: 13,301
Reputation: 1909
|
Two common ones related to alternate editors added.
|
|
|
|
|
|
#5 | |||
|
High-roller
![]() ![]() ![]() ![]() ![]() Join Date: Jun 2009
Location: The Polish guy in The Netherlands
Posts: 2,297
Reputation: 281
|
little typo in 10)
Quote:
Quote:
Quote:
|
|||
|
|
|
|
|
#6 |
|
High-roller
![]() ![]() ![]() ![]() ![]() Join Date: Jan 2012
Location: New Delhi, India
Posts: 1,146
Reputation: 345
|
Good tutorial!Good help ppl
|
|
|
|
|
|
#7 |
|
High-roller
![]() ![]() ![]() ![]() ![]() Join Date: Sep 2011
Location: New-Zealand
Posts: 1,894
Reputation: 46
|
Thanks for this tutorial, very usefull
![]() Bye! |
|
|
|
|
|
#8 | |
|
Huge Clucker
![]() ![]() ![]() Join Date: Jul 2011
Posts: 282
Reputation: 13
|
Quote:
sorry for bump, but... How do I do that? I'm using PawnScITe from Darkimmortal |
|
|
|
|
|
|
#9 |
|
Huge Clucker
![]() ![]() ![]() Join Date: Jul 2011
Posts: 282
Reputation: 13
|
bump?
|
|
|
|
|
|
#10 | |
|
High-roller
![]() ![]() ![]() ![]() ![]() Join Date: Aug 2009
Location: Romania
Posts: 1,011
Reputation: 86
|
Quote:
pawn Code:
Or you did a mistake regarding the warning / error you get ? ![]() Anyhow, great tutorial overall, really helpful. ps: Maybe you pasted the wrong error ? |
|
|
|
|
![]() |
| Thread Tools | |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Some errors and warnings | MusicBeast | Scripting Help | 2 | 11/10/2011 02:02 PM |
| Some errors/warnings | Anzhelov | Server Support | 1 | 21/02/2011 09:22 PM |
| Errors/Warnings help | marinov | Help Archive | 4 | 06/11/2010 06:07 PM |
| 5 Errors and 3 Warnings | nuriel8833 | Help Archive | 2 | 28/08/2010 07:07 AM |