SA-MP Forums Archive
#define seems not to work - 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: #define seems not to work (/showthread.php?tid=631542)



#define seems not to work - rt-2 - 31.03.2017

Hello,
I have had this issue :
file 1:
Code:
#define WEAPON_UNKNOWN 55
file 2:
Code:
[Using WEAPON_UNKNOWN]
file 3 includes both files and I get this error
Code:
../include/file2.pwn(282) : error 017: undefined symbol "WEAPON_UNKNOWN"
File 1 is actually weapon-config.inc, and i'm trying to use the constant WEAPON_UNKNOWN in another script that is included AFTER weapon-config.inc
But normally this is supposed to work, I had some instance of this happening with functions too.
This is very annoying.

Thank you,
Yanick


Re: #define seems not to work - AndreiWow - 31.03.2017

Why don't you put the define in the file 2? It will work in the file 1 too if you include file 2...


Re: #define seems not to work - rt-2 - 31.03.2017

Quote:
Originally Posted by AndreiWow
View Post
Why don't you put the define in the file 2? It will work in the file 1 too if you include file 2...
So you mean to tell me that a constant can be used in the files included before, but not after??!


Re: #define seems not to work - AndreiWow - 31.03.2017

Quote:
Originally Posted by rt-2
View Post
So you mean to tell me that a constant can be used in the files included before, but not after??!
I am not sure as I never tried to do this, try and see if it works.