warning 201: redefinition of constant/macro -
Konstantinos - 11.12.2012
I know that error is caused because it's defined 2 times, but I'm using two different includes that use at the end:
pawn Код:
// 1st include
#define PutPlayerInVehicle sth1_PutPlayerInVehicle
// 2nd include
#define PutPlayerInVehicle sth2_PutPlayerInVehicle
I tried to rename it, but then I have to do the function 2 times and that's a problem.
How can I fix it from the warning and the function "PutPlayerInVehicle" should work for both includes?
Re: warning 201: redefinition of constant/macro -
ReVo_ - 11.12.2012
PutPlayerInVehicle2
Re: warning 201: redefinition of constant/macro -
Konstantinos - 11.12.2012
The problem is that if I use it on a /v command to spawn a vehicle, when I'm on foot, it puts me in the vehicle was created and then it tries to put me 2nd time and it fails. As I mentioned above, I do not want to do this. Just "PutPlayerInVehicle" only one time and do what includes file say. But it keeps giving me the warning.
Re: warning 201: redefinition of constant/macro -
Konstantinos - 13.12.2012
I would appreciate if someone could help me with that warning. The only way, atleast for me is not to use the one of the includes, but I want to use both of them! Is there any way to use these two includes together without any warning?
Re: warning 201: redefinition of constant/macro -
HarryPotter - 13.12.2012
You cannot use them both as they both has the same definition, however you can change one PutPlayerVehicle to PutPlayerInVehicle etc or something else to avoid the re-definition, else I don't see how you can use them both.
Re: warning 201: redefinition of constant/macro -
Konstantinos - 13.12.2012
What do you mean, ******? Can you be more specific, please!
I'm using the one include "fixes.inc" which defines "PutPlayerInVehicle" and I'm also using an include about airbreak detection which defines this function. I've never use ALS before and I don't know how I can fix it. Can you explain me or with some examples, atleast to understand it!
@HarryPotter, read the above commands please. As I've said, it is bugged with this function, if I put a player in a vehicle twice.
Re: warning 201: redefinition of constant/macro -
LarzI - 13.12.2012
Quote:
Originally Posted by Dwane
What do you mean, ******?
|
I think he's talking about hooks
https://sampforum.blast.hk/showthread.php?tid=166016
Re: warning 201: redefinition of constant/macro -
Konstantinos - 13.12.2012
Thanks LarzI, I've read this + two tutorials about hook but what I've noticed is that they shows how to hook a callback. I don't know how to do it for a function. Or is it the same way?
Re: warning 201: redefinition of constant/macro -
LarzI - 13.12.2012
Quote:
Originally Posted by Dwane
Thanks LarzI, I've read this + two tutorials about hook but what I've noticed is that they shows how to hook a callback. I don't know how to do it for a function. Or is it the same way?
|
I have absolutely no idea. I'll have to investigate some before I have an answer. I'll edit this post if I find anything.
Edit: I've only seen usage of ALS with callbacks in includes like zcmd and such, but it's no harm testing it with functions?
Example:
pawn Код:
#if defined _ALS_PutPlayerInVehicle
#undef PutPlayerInVehicle
#else
#define _ALS_PutPlayerInVehicle
#endif
#define PutPlayerInVehicle sth1_PutPlayerInVehicle
pawn Код:
#if defined _ALS_PutPlayerInVehicle
#undef PutPlayerInVehicle
#else
#define _ALS_PutPlayerInVehicle
#endif
#define PutPlayerInVehicle sth2_PutPlayerInVehicle
I have absolutely no idea what this does, why it does it, and lastly if it even will work, but hey, it's worth a shot? I guess..
Re: warning 201: redefinition of constant/macro -
Konstantinos - 13.12.2012
Quote:
Originally Posted by LarzI
I have absolutely no idea. I'll have to investigate some before I have an answer. I'll edit this post if I find anything.
Edit: I've only seen usage of ALS with callbacks in includes like zcmd and such, but it's no harm testing it with functions?
Example:
pawn Код:
#if defined _ALS_PutPlayerInVehicle #undef PutPlayerInVehicle #else #define _ALS_PutPlayerInVehicle #endif #define PutPlayerInVehicle sth1_PutPlayerInVehicle
pawn Код:
#if defined _ALS_PutPlayerInVehicle #undef PutPlayerInVehicle #else #define _ALS_PutPlayerInVehicle #endif #define PutPlayerInVehicle sth2_PutPlayerInVehicle
I have absolutely no idea what this does, why it does it, and lastly if it even will work, but hey, it's worth a shot? I guess..
|
I replaced the #define ... and it doesn't give the warning anymore. Thanks a lot!
Quote:
Originally Posted by ******
You mentioned fixes.inc which does this too. And that code looks right to me.
|
Yeah, I noticed that fixes.inc used ALS, but the other include didn't. Thanks for your help!