Skip to content
⌘ NSIS Forum Archive

.NSH with nested !include question...

4 posts

JeronimoColon#

.NSH with nested !include question...

I have begun to break out a fair amount of code into "Helper Libraries" using .nsh files because my latest installer is over 1500 lines and much of it can be re-used in future installers. With that said, I'm having a problem with nested !includes.

The main .nsi file has a !include for "FileFunc.nsh" as well as one of my custom .nsh files. When I compile I get an error:

!define: "FILEFUNC_VERBOSE" already defined!
!include: error in script: "C:\Program Files\NSIS\Include\FileFunc.nsh" on line 82
!include: error in script: "MSILibrary.nsh" on line 6

I'm clearly doing something wrong. What is the correct way to have a common .nsh file included in multiple files?

I may break these libraries out further to even more descrete tasks so there may be a .nsh file !including another .nsh file and both sharing a common .nsh file.

As an aside: This is kinda why I created a post earlier about "Best Practices" for larger installer cause I knew I'd screw this up... 🙂

Thanks in advance.
Red Wine#
A common error when !include headers is if you !include first a header that uses another one.
e.g.
!include "myheader.nsh" ;this header uses LogicLib
!include "LogicLib.nsh"
this is wrong, should be:
!include "LogicLib.nsh"
!include "myheader.nsh"
Instructor#
Are you a developer who uses NSIS to distribute your application? Are you a Winamp plug-in developer who wants to use NSIS to distribute your plug-in? Have suggestions for other people like you? This is the place.
JeronimoColon#
Thank you Red! - I didn't know that. I made the changes you suggested but it didn't solve this particular problem, but at least I know going forward.

Thank you Instructor! - The corrected versions of the .nsh files in the link you provided did the trick!

I take it this will be in the next update of NSIS...

Thanks again.

jc3