[TUT] Compiling errors
A friend messaged me on steam the other day, asking me to help him debug his plugin. I asked whether he knew how to read the error and warning messages to which he replied "no". As of 16/03/2009, i dont think there is a tutorial to read these messages so i thought i would create 1
Note: This is mainly for newbie scripters, as im guessing alot of intermediate / advanced scripters allready know about these error messages The error messages of doom Below is an example of an error message when trying to compile. Quote:
1) "C:\Users\Stu\Desktop\other\Stu's plugins\b_rush.sma" This is where the source code of the plugin is saved. In my case, it is held in a folder on my desktop called "Stu's Plugins". It might be a good idea to create a folder on your desktop to keep all your plugins neat and tidy. Another good place to house plugins would be "C:/Program Files/Pawn Studio/Plugins", or "C:/Program Files/AMXMODX/Plugins" 2) "(107)" (1/3 Main parts that you need to know) The number within the brackets is what line the error/warning has been found. In our case, its occouring on line 107. With most good IDE's (Pawn Studio, AMXX Studio, etc.) the line numbers are printed down the left hand side to make it easier to find. If you're useing notepad or similar, there may be a keyboard shortcut E.g. Ctrl+H to goto a specific line number 3) "error 035:" This is the error code. Im not entirely sure if there is a list of pawn error codes, so ill probably steal the 2nd post and make a list of them there. Allthough this error code is not nesseserily needed, it might be worth noting it down and how you fixed it for future reference. 4) "argument type mismatch" (2/3 Main parts that you need to know) In our case, an "argument type mismatch" is where the function "client_print" dosent have enough parameters. 5) "(argument 2)" (3/3 Main parts that you need to know) This shows precisely where the error is within the function Break it down So now we have broken down the error, we have a clearer view of where the error is and what is wrong Part 1/3 shows that the error is on line 107 If we find our line 107, we find this: Code:
client_print(0, "Welcome to the server!"); 3/3 shows that argument 2 is incorrect What should it be? Lets check funcwiki and see what the client_print function should be: Quote:
So we can see that client_print should have a minimum of 3 arguments. Our code has 2 So lets check where we went wrong our "index" is set to "0" This is fine (Will print to the server) Our "type" is set to "Welcome to the server!" This is not a type, because the funcwiki says that we need to use print_chat, print_console, print_notify, or print_center. If we check number (5) of our error again, we see that the error was in "(argument 2)", so this would back up our assumption that the "type" was wrong Fixing the error So we can now go back to line 107 and change it to this: Code:
client_print(0, print_center, "Welcome to the server!"); Now lets re-compile and see what happens... Oh look! Quote:
x |
Re: [TUT] Compiling errors
Thanks to Stupok =]
Quote:
|
Re: [TUT] Compiling errors
PHP Code:
|
Re: [TUT] Compiling errors
fixed =]
|
Re: [TUT] Compiling errors
Glad someone finally did it. I never got around to it. GJ.
|
Re: [TUT] Compiling errors
Nice tut, certainly helpful for those unfamiliar with compilers.
Quote:
|
Re: [TUT] Compiling errors
Quote:
from amxmodx-1.8.1\compiler\libpc300\sc5.scp Code:
static char *errmsg[] = { |
Re: [TUT] Compiling errors
nice 1 dude
ill update 2nd post when i get home |
Re: [TUT] Compiling errors
1 Attachment(s)
It should also be noted that the errors aren't always caused by what the compiler says it's causing them.
For instance, today while I was working on ZP I started getting lots of error 017: undefined symbol "xxxxxx" (screenshot attached to post). About half an hour later I found out it was caused by the following code: Code:
And this is yet another reason why you should regularly backup your files... |
Re: [TUT] Compiling errors
so technically, it was correct
ISurvivor wasnt defined So it was just a minor typo |
All times are GMT -4. The time now is 22:13. |
Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.