Compiler Crash
#1

I'm having some really frustrating issue with the compiler crashing on me.

It is (indirectly) caused by adding a simple color #define. And it has something to do with how many functions/defines I have in my script. Am I wrong to think that PAWN doesn't have a limit on how many functions/defines you can declare?

Anyway, everything works, but then if I add '#define COLOR_PURPLE 0xFFwhatever' to the top of my script, the compiler crashes. But then, If I remove an EMPTY function (no code inside it) from the bottom of my script, it works. It seems the compiler will only let me have one or the other.

Another thing I did to fix it was move an enum declaration to the top of my script. It then moved it down bit by bit until the compiler crashed, and it seemed to be caused by another enum. I thought I had found the problem, but upon commenting out the other enum and putting mine back to where it was, I re-added the blank function at the bottom of my script (wasn't blank, but I commented everything out to check) the compiler started crashing again..

I am extensively using YSI and y_hooks, and this this may be the cause.

Any ideas? I am literally about to give up because this is so random and unfixable.

EDIT: Okay I have done some playing around and discovered something that makes no sense.

It seems that the value of my COLOR_PURPLE define is causing the compiler crash if it's too high?! Look below


EDIT: Okay, narrowed it down a bit more..

So it must be to do with the length of the value (seeing as defines are just text-based replacement and have no concept of value). How can this even be a problem?! I have other color defines throughout my script which have no problem, but it seems I cannot add any more?
Reply
#2

Have you tried looking where the COLOR_PURPLE is being used and checking if where you have used the value could be causing the issue. Because it could be used on a line where its too long and by adding that value that big its causing the compiler to freak out
Reply
#3

To define colors just use #define COLOR_NAME {hex code}. The hex code is without 0x or the 0xFFFFFFFF the last 2 Fs are don't needed between {}. I hope I helped you.
Reply
#4

Quote:
Originally Posted by JessThompson
Посмотреть сообщение
Have you tried looking where the COLOR_PURPLE is being used and checking if where you have used the value could be causing the issue. Because it could be used on a line where its too long and by adding that value that big its causing the compiler to freak out
I haven't used it anywhere. It doesn't matter what the first part of the #define is, just what the value is.

Anyway, I have changed to using Zeex's compiler and it's fine now, but I'd still like to know what was causing the issue in the first place.

EDIT: Great, apparently changing compiler didn't actually fix it. I now sort of have the same problem, but it's more about functions than defines. I have my #define COLOR_PURPLE in an included file with no problem. A problem arises when I call a function that resides in my main mode file from an included module. Just calling this function (even replacing it with a blank function) causes the compiler to crash. However, stragely, removing the COLOR_PURPLE define fixes it?! I can't define COLOR_PURPLE with any value now. It's something to do with calling the functions. I strongly believe this has something to do with y_hooks because y_hooks has corrupted the 'functions table' or whatever before.

EDIT: If I put COLOR_PURPLE at the top of the script (before a_samp), I can define values up to a certain length as seen in my original post images. However, if the define is in another file that I include later on, I can't define it at all without a crash.

EDIT: Okay, another update. I accidentally tried to compile an include and got the error 'no entry point', which I know means main() is missing. I had an idea. If main() is the entry point - should it be at the top before anything else? I did this, put main() just before a_samp and everything seems okay. For now.
Reply
#5

I think it crashs because COLOR_PURPLE is already defined.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)