Archive: Unable to use complex if-elseif-else structure


Unable to use complex if-elseif-else structure
When I tried to use a structure like this, it did not work the way I expected (using NSIS v2.0b2):


!ifdef Label_1
!define X aa
!define Y bb
!else ifdef Label_2
!define X cc
!define Y dd
!else ifdef Label_3
!define X ee
!define Y ff
...
!else ifdef Label_7
!define X ww
!define Y xx
!else
!define X yy
!define Y zz
!endif

When, say, Label_2 was defined, the compiler processed the 2 defines I expected and then also tried to process the two in the very last block, so it complained that X was already defined.

So I changed the last block's !else line to !else ifndef Label_7 to get what I wanted.

Was my original idea flawed?

This was fixed in the latest CVS version. Please use NSIS Update to get the latest "untested" files.


Thanks for the very quick reply. I've updated my copy of NSIS and successfully compiled the code that gave me trouble.

I'd never used NSIS Update before. It worked very well - what an excellent idea!