PDA

View Full Version : Error C8059 after Service Pack 1



timelox
06-26-2008, 03:51 AM
After installing SP1 I cannot build my scripts anymore.
I get the following error:

C:\InstallShield 2009 Projects\...\Script Files\Setup.Rul(697) : error C8059: 'elifdef' : unrecognized preprocessor command

The "#elifdef" preprocessor command has worked fine prior to installing SP1. Why does it not work anymore? Workaround?

MichaelU
06-27-2008, 10:50 AM
I just tried compiling a default empty script after adding the following lines:
#ifdef UNDEFINED
#elifdef REALLYUNDEFINED
#endifand it compiled cleanly. Could you look in your code for other local problems, or post a minimal reproduction case?

timelox
06-30-2008, 02:53 AM
If both 'UNDEFINED' and 'REALLYUNDEFINED' is defined in your sample project you would get the same error.

I had forgot to comment out one of the defines in my project. That's why I got the error.
However, I find the error a bit confusing though. I my eyes this is still a bug in the IDE.

timelox
06-30-2008, 07:17 AM
Hmm...there seems to be more to this issue.

I created an empty InstallScript MSI project and only added the following lines of code in the Setup.rul file.

#include "ifx.h"

#define DEF_A
//#define DEF_B

function OnBegin()
begin
#ifdef DEF_A
MessageBox("DEF_A defined", MB_OK);
#elifdef DEF_B
MessageBox("DEF_B defined", MB_OK);
#else
MessageBox("Nothing defined", MB_OK);
#endif
end;

If I compile the above it gives me the C8059 error.
No matter if DEF_B is defined or not, it will always fail if DEF_A is defined when I try to compile the above on my machine.

MichaelU
06-30-2008, 09:48 AM
Ah, gotcha. We've done some further testing, and this is a long standing behavior, back to at least DevStudio 9, and probably InstallShield Professional. My personal hunch is that it's a bug in our syntax highlighting that #elifdef is highlighted, as well as possibly a bug in the handling of symbols such that it doesn't trigger an error when it's in an excluded #if... section, but we're looking into it. In the meantime, I'd suggest something like the obvious, if ugly, nested workaround of:

#ifdef FOO

#else
#ifdef BAR

#endif
#endif

DevinEllingson
06-30-2008, 02:20 PM
#elifdef is not supported. It is incorrectly documented any syntax colored. This will be corrected in a future release.

#elif should be used instead (which requires that you test for the exact value of the constant).

Devin Ellingson
Software Developer
Acresso Software

timelox
07-01-2008, 01:33 AM
Thanks for the information. Now I can alter the script to bypass the compile error. Why did it compile (and work) before SP1?

By 'will be corrected in a future release' do you mean it will be removed from the documentation or implemented?

I suggest you implement 'elifdef' for completeness since you have the other commands implemented (if, elif, else, ifdef, etc...). It doesn't feel right to lack that specific command.

DevinEllingson
07-01-2008, 04:29 AM
We didn't change anything in SP1 related to this (elifdef has never been supported), so if the script compiled previously something must have changed on your system which caused the compiler to attempt to compile this line, where it didn't before.

We may add this in a future release, but for now we will remove it from documentation and syntax coloring.

Devin Ellingson
Software Developer
Acresso Software

timelox
10-08-2008, 08:19 AM
#elif should be used instead (which requires that you test for the exact value of the constant).

Actually that doesn't work either (bug?).

I created a new InstallScript MSI containing only this code:


#include "ifx.h"

#define BETA_BUILD "33"
#define RC_BUILD "7"

#define TAG_NONE 0
#define TAG_BETA 1
#define TAG_RC 2
#define TAG_BUILD 3
#define SHOW_TAG TAG_RC

function OnBegin()
STRING szMsg;
begin
#if ( SHOW_TAG = TAG_BETA )
szMsg = @PRODUCT_NAME + " v" + @PRODUCT_VERSION + " beta " + BETA_BUILD;
#elif ( SHOW_TAG = TAG_RC )
szMsg = @PRODUCT_NAME + " v" + @PRODUCT_VERSION + " RC " + RC_BUILD;
#elif ( SHOW_TAG = TAG_BUILD )
szMsg = @PRODUCT_NAME + " v" + @PRODUCT_VERSION + " build " + BETA_BUILD;
#else
szMsg = @PRODUCT_NAME + " v" + @PRODUCT_VERSION;
#endif

MessageBox(szMsg, MB_OK|MB_ICONINFORMATION);
end;

When I single step through the code in the debugger it first stops at the line after #elif ( SHOW_TAG = TAG_RC ) as it should.
BUT when I hit F10 to advance to the next position it stops at the line after #else which is wrong.
The resulting message will be "Test v1.00.0000" instead of "Test v1.00.0000 RC 7"