It turns out to be the following: some of the code for the installer I am writing will be automatically generated and placed into a header file. This code is effectively just code portions that we !include in the Sections of the installer. E.g.NSIS Error: label "_LogicLib_Label_7.1.5:" already declared in section
The contents of the .nsh files is just the installation steps to install tool A, i.e. the files and directories for that tool, registry entries if needed etc.
Section
DetailPrint "Installing Tool A..."
!include tool.a.nsh
!include tool.a.dependency.nsh
SectionEnd
Now, the situation I was in was that both the header files tool.a.nsh and tool.a.dependency.nsh contained a call to a certain macro (with different parameters each time) and in both cases that macro call was on line 7 of the .nsh file. I need to call this macro in the .nsh as it sets up some configuration data for use later in the installer.
This macro uses the LogicLib and having had a quick look at the LogicLib header file, it seems that the ${If} macros use the line numbers to generate goto labels based upon line numbers in the file that they are in. However, since the macro was called on the same line in each .nsh file, this meant that LogicLib generated the same label twice which, of course, confuses the compiler.
I have attached an example to illustrate this problem and it generates the error:
How can I get around this problem? I can't add a new line to the .nsh files because they are to be generated by another program.
Error: label "_LogicLib_Label_1.1.5:" already declared in section
Error in macro _Else on macroline 13
Error in macro EG04_LogicLibMacroFun on macroline 3
!include: error in script: "tool.a.dependency.nsh" on line 1
I would prefer to stick with using the LogicLib if possible, because it is easier to read and maintain.
Thanks in advance.