greena23
13th September 2010 11:17 UTC
Function Definition Problems
Hi,
I am reusing an old function I used on another installer of mine. It is one I found online to check the version of a file. I runs fine in the other installer, but in the other one is gives this error -
!define: "GetFileVersion" already defined!
Error in Script "(script location and name)" on line 203 -- aborting creation process
The code itself is:
Function GetFileVersion
!define GetFileVersion `!insertmacro GetFileVersionCall`
!macro GetFileVersionCall _FILE _RESULT
Push `${_FILE}`
Call GetFileVersion
Pop ${_RESULT}
!macroend
Exch $0
Push $1
.......
.......
I have checked and there are no other references to GetFileVersion in the code.
Has anyone any suggestions?
MSG
13th September 2010 11:21 UTC
First of all, I wouldn't put define and macro declarations inside a function, it looks ugly. I'm not even sure if it's valid NSIS code, but I've never looked into that so whatever. But if the compiler says something's already defined, then it's already defined. Look in your include files, for example.
Either way, get those declarations out of that function.
greena23
13th September 2010 12:14 UTC
If it is helpful this is where I got the code from
http://nsis.sourceforge.net/GetFileVersion
greena23
13th September 2010 13:14 UTC
If this is in anyway helpful this is where I got the code for the version check.
http://nsis.sourceforge.net/GetFileVersion
I have search but cannot find at all where they were defined before. I did a ctrl+f aswell and nothing.
Any help would be much appreciated
jpderuiter
13th September 2010 13:20 UTC
Are you maybe including FileFunc.nsh?
This function is defined there nowadays:
http://nsis.sourceforge.net/Docs/AppendixE.html#E.1.8
greena23
13th September 2010 15:05 UTC
I was unaware it was defined in FileFunch.nsh I've removed code and it compiles now. However I have a different problem. I am taking this version no. and I am trying to compare it with a set version number. However it keeps saying my version is newer even when it isn't.
I am using this code http://nsis.sourceforge.net/Comparin...ersion_Numbers to compare the version numbers. However I cannot understand why the it is always saying the version is newer
Afrow UK
13th September 2010 17:32 UTC
Use VersionCompare from WordFunc.nsh
Stu