Preprocessor Bug?
sausix
Posts: 4
Hi supporters
I've encountered a strange compiler error. A second use of a DEFINE-Symbol throws a
Works (checked variable in debug window):
Doesn't work:
Am i doing something wrong?
Studio:4.1.1251
Compiler: 2.5.2.420
I'm temporary unable to update to the latest studio to test it there...
Thanks
Adrian
I've encountered a strange compiler error. A second use of a DEFINE-Symbol throws a
C10233: Symbol [USE_DEVICE] not defined
Works (checked variable in debug window):
PROGRAM_NAME='code' #DEFINE USE_DEVICE 5001 DEFINE_DEVICE dvSerial1=USE_DEVICE:1:1
Doesn't work:
PROGRAM_NAME='code' #DEFINE USE_DEVICE 5001 DEFINE_DEVICE dvSerial1=USE_DEVICE:1:1 dvSerial2=USE_DEVICE:2:1
Am i doing something wrong?
Studio:4.1.1251
Compiler: 2.5.2.420
I'm temporary unable to update to the latest studio to test it there...
Thanks
Adrian
0
Comments
What are you trying to accomplish? Automatically have code determine if it should should IP, serial or IR for a device that supports multiple comm protocols like TVs in a module written to handle any mode?
As a workaround, it looks like this works fine:
but this doesn't:
And that is always the only things I ever used it to do.
But then the help goes on to give examples of using it like this:
Which seems to go against the "used only by #IF_DEFINED and #IF_NOT_DEFINED" statement.
I'm going to say it's a bug... in the documentation.
As a programmer coming from other higher programming languages, i often discover weird things in Amx. The documentation is really old and should be updated. Many things are missing there. Would be nice to have an open wiki.
As already said, i refered to the string literals in the manual examples.
In this example i wanted to define compile switches f?r each kind of controller. I just switched to using an include file for each type of controller.
Thanks!
Adrian Sausenthaler