Skip to content
⌘ NSIS Forum Archive

Variable declarations - Different files.

4 posts

Sheik#

Variable declarations - Different files.

Hi all,

I have a question/problem dealing with variable declarations.

I have an Installer script that 3 files.
1) main.nsi
2) custompage1.nsi
3) custompage2.nsi

In custompage1.nsi, I declare a global variable that I want to be "seen" in main.nsi and custompage2.nsi.

When I try to reference said variable in main.nsi, it says that its "unknown variable/constant.

Now, I know I can declare it in main.nsi, and that works fine... But I was hoping I could declare the variable in the file that "owns" it...

Is there a way to tell main.nsi / custompage2.nsi that another file that I am including has declared said variable?
Kind of something like "extern" in C?

Thanks!
Scott
Sheik#
Well, it seems to work when in main.nsi.

But if I try to use a variable in custompage2.nsh, that was declared in custompage1.nsi, that appears to fail with a: "unknown variable/constant.
Afrow UK#
If you include custompage2.nsh in custompage1.nsi and then include custompage1.nsi in your main.nsi then it should be fine.

Stu