SA-MP Forums Archive
../include/gl_common.inc - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: ../include/gl_common.inc (/showthread.php?tid=432334)



../include/gl_common.inc - ShaneOvSina - 22.04.2013

I keep getting this when i compile.
i am trying to add The Cars On to my server

Код:
../include/gl_common.inc(80) : error 021: symbol already defined: "strtok"
../include/gl_common.inc(139) : error 021: symbol already defined: "isNumeric"
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


2 Errors.
Код:
//----------------------------------------------------------

stock strtok(const string[], &index)
{
	new length = strlen(string);
	while ((index < length) && (string[index] <= ' '))
	{
		index++;
	} //--Line 80

	new offset = index;
	new result[20];
	while ((index < length) && (string[index] > ' ') && ((index - offset) < (sizeof(result) - 1)))
	{
		result[index - offset] = string[index];
		index++;
	}
	result[index - offset] = EOS;
	return result;
}

//------------------------------------------------
Код:
//----------------------------------------------------------

stock isNumeric(const string[])
{
  new length=strlen(string);
  if (length==0) return false;
  for (new i = 0; i < length; i++)
    {
      if ( //--Line 139
            (string[i] > '9' || string[i] < '0' && string[i]!='-' && string[i]!='+') // Not a number,'+' or '-'
             || (string[i]=='-' && i!=0)                                             // A '-' but not at first.
             || (string[i]=='+' && i!=0)                                             // A '+' but not at first.
         ) return false;
    }
  if (length==1 && (string[0]=='-' || string[0]=='+')) return false;
  return true;
}

//----------------------------------------------------------
I Hope you can help with the details I've Given


Re: ../include/gl_common.inc - Faisal_khan - 22.04.2013

Remove the line:
pawn Код:
#include <gl_common>
from your script.
Because those functions are defined in your script as well as in the include.


Re: ../include/gl_common.inc - ShaneOvSina - 22.04.2013

That isnt on my script...


Re: ../include/gl_common.inc - Lordzy - 22.04.2013

Well then any include you have used in the script will be having the functions 'isnumeric' and 'strtok'. That's why it's showing symbol is already defined. If you've any other purposes in using gl_common, I suggest you to remove 'strtok' and 'isnumeric' functions from it or remove it from the script or include which has it.


Re: ../include/gl_common.inc - Faisal_khan - 22.04.2013

Check if you have those functions defined in your script.