Home AMX User Forum NetLinx Studio

Won't compile - why?

jjamesjjames Posts: 2,908
Just wrote a module, and I like to line things up and such in code, and I'm wondering why this won't compile:
DEFINE_MODULE 'ZTUNER_GUI_COMM' 	ZTUNER1	 
(
	vdvZTUNER		,// VIRTUAL DEVICE
	dvZTUNER		,// REAL DEVICE
	dv_TP			,// TOUCH PANELS THAT CONTROL ABOVE REAL DEVICE
	nZTUNER_BTNS		,// ZTUNER BUTTONS
	nZTUNER_PRESETS		,// ZTUNER PRESETS
	nGUI_OPTIONS		 // ADDITIONAL TP / ZTUNER OPTIONS
)	

but this will:
DEFINE_MODULE 'ZTUNER_GUI_COMM' 	ZTUNER1	 
	(vdvZTUNER		,// VIRTUAL DEVICE
	dvZTUNER		,// REAL DEVICE
	dv_TP			,// TOUCH PANELS THAT CONTROL ABOVE REAL DEVICE
	nZTUNER_BTNS		,// ZTUNER BUTTONS
	nZTUNER_PRESETS		,// ZTUNER PRESETS
	nGUI_OPTIONS)		 // ADDITIONAL TP / ZTUNER OPTIONS

Any ideas?

Comments

  • Parameters of a module must be in (), also if your module would have no parameters.

    If you do it absolutely correct, the module definition needs also an instance name (you MUST do this if you use the module in multiple instances):
    DEFINE_MODULE 'ZTUNER_GUI_COMM' ZTUNER1 'ZTuner1'
    (vdvZTUNER,// VIRTUAL DEVICE
    dvZTUNER,// REAL DEVICE
    dv_TP,// TOUCH PANELS THAT CONTROL ABOVE REAL DEVICE
    nZTUNER_BTNS,// ZTUNER BUTTONS
    nZTUNER_PRESETS,// ZTUNER PRESETS
    nGUI_OPTIONS) // ADDITIONAL TP / ZTUNER OPTIONS
    
  • DHawthorneDHawthorne Posts: 4,584
    The parentheses and instance name are both there in both of his examples, the only difference is how they are placed regarding whitespace and comments. The funny thing is I tried it both ways in some code of mine, and both compiled.
  • jjamesjjames Posts: 2,908
    DHawthorne wrote:
    The funny thing is I tried it both ways in some code of mine, and both compiled.
    Thanks David, I'll have to take a look at the whole picture then rather than focusing on just the module definition; it's probably something really stupid in my code. I'll comment out whatever I can and see if it makes any difference.
  • DHawthorne wrote:
    The funny thing is I tried it both ways in some code of mine, and both compiled.

    Not me...I achieved the same results as jjames...different builds of studio???

    I have Studio 2.4.0.129

    Compiler 2.3.0.0
  • jjamesjjames Posts: 2,908
    I have Studio 2.4.0.129

    Compiler 2.3.0.0

    Same here . . .
  • Joe HebertJoe Hebert Posts: 2,159
    The compiler is having an issue with the last argument. Even if you remove the last comment I believe you will find it will generate an invalid syntax error and not compile.
    //Won?t compile
    DEFINE_MODULE 'ZTUNER_GUI_COMM' 	ZTUNER1	 
    (
    	vdvZTUNER	,// VIRTUAL DEVICE
    	dvZTUNER	,// REAL DEVICE
    	dv_TP		,// TOUCH PANELS THAT CONTROL ABOVE REAL DEVICE
    	nZTUNER_BTNS	,// ZTUNER BUTTONS
    	nZTUNER_PRESETS	,// ZTUNER PRESETS
    	nGUI_OPTIONS
    )
    

    However if you hit the backspace key and bring the closing paren to the same line as the last argument then I believe you will find it compiles fine.
    //Will compile
    DEFINE_MODULE 'ZTUNER_GUI_COMM' 	ZTUNER1	 
    (
    	vdvZTUNER	,// VIRTUAL DEVICE
    	dvZTUNER	,// REAL DEVICE
    	dv_TP		,// TOUCH PANELS THAT CONTROL ABOVE REAL DEVICE
    	nZTUNER_BTNS	,// ZTUNER BUTTONS
    	nZTUNER_PRESETS	,// ZTUNER PRESETS
    	nGUI_OPTIONS)
    
    Sounds fishy to me.
  • Jeremijah, Dave,

    sorry, I was blind :o (why is the forum not highlighting the source :rolleyes: )
  • DHawthorneDHawthorne Posts: 4,584
    I wasn't testing with this exact code; I tried those formats with a module of my own. Perhaps it's dependant on the variable type of the last argument. My computer is on the fritz, and I'm working on another right now, so I can't check what it was with the one I tested (well, not easily, I've only copied over the files I need to work with today from my backup).
  • DHawthorne wrote:
    I wasn't testing with this exact code.

    Me Neither...This is what I used...

    Does Not Compile...
    DEFINE_MODULE 'PolycomVSX8000UI'  mdlPolycomVSX8000_APP
    (
    				vdvCodec, 
    				TPArray, 
    				nBTN_ARRAY_POLY_COM
    )
    

    Does Compile...
    DEFINE_MODULE 'PolycomVSX8000UI'  mdlPolycomVSX8000_APP
    (
    				vdvCodec, 
    				TPArray, 
    				nBTN_ARRAY_POLY_COM)
    
  • chippychippy Posts: 5
    I have had compile issues on multiple occasions in different areas of code, and the only fix was to RE TYPE the entire section.
    Tech Support (multiple members) have confirmed this kind of SNAFU does occur. MADDENING...
  • DHawthorneDHawthorne Posts: 4,584
    I think I have this pinned down: if the last parameter in the module definition is an array, the closing parenthesis has to be on the same line. Tabs don't seem to bother it, or other whitespace, but endlines do. Non-array data types don't seem to have the same prolem.
  • Joe HebertJoe Hebert Posts: 2,159
    I can confirm what you are seeing Dave. Same results here.
    DHawthorne wrote:
    I think I have this pinned down: if the last parameter in the module definition is an array, the closing parenthesis has to be on the same line. Tabs don't seem to bother it, or other whitespace, but endlines do. Non-array data types don't seem to have the same prolem.
Sign In or Register to comment.