Program compiles in V3 but not in V4

For Flowcode users to discuss projects, flowcharts, and any other issues related to Flowcode 4.
To post in this forum you must have a registered copy of Flowcode 4 or higher. To sign up for this forum topic please use the "Online Resources" link in the Flowcode Help Menu.

Moderator: Benj

Post Reply
Zane
Flowcode v5 User
Posts: 199
Joined: Thu Sep 10, 2009 10:57 pm
Location: New Zealand
Has thanked: 93 times
Been thanked: 76 times

Program compiles in V3 but not in V4

Post by Zane »

Hi,

I have a program that will compile under version 3 of flowcode but when the same file is opened in version 4 it will not compile. The compiler generates the following messages
..........................................................................................................

C:\Users\Wine Cellar I2C PIC18F452.c(2494:33): error: failed to generate expression
C:\Users\Wine Cellar I2C PIC18F452.c(2494:33): error: invalid operand '- 9'
C:\Users\Wine Cellar I2C PIC18F452.c(2494:31): error: failed to generate expression

...................

C:\Users\Wine Cellar I2C PIC18F452.c(6772:18): error: failed to generate expression
C:\Users\Wine Cellar I2C PIC18F452.c(6772:18): error: invalid operand '- 128'
C:\Users\Wine Cellar I2C PIC18F452.c(6772:16): error: failed to generate expression
C:\Users\Wine Cellar I2C PIC18F452.c(6847:18): error: failed to generate expression
C:\Users\Wine Cellar I2C PIC18F452.c(6847:18): error: invalid operand '- 128'
C:\Users\Wine Cellar I2C PIC18F452.c(6847:16): error: failed to generate expression
C:\Users\Wine Cellar I2C PIC18F452.c(6922:18): error: failed to generate expression
C:\Users\Wine Cellar I2C PIC18F452.c(6922:18): error: invalid operand '- 128'
C:\Users\Wine Cellar I2C PIC18F452.c(6922:16): error: failed to generate expression

.............

Wine Cellar I2C PIC18F452.c success

failure

Return code = 1

Flowcode was unable to compile the flowchart's C code due to the following errors:


If your flowchart contains C code, please review this carefully. If your flowchart contains no C-code or you have thoroughly reviewed the code, contact Technical Support.

FINISHED


Any help would be most welcomed.

Thanks

User avatar
Steve
Matrix Staff
Posts: 3434
Joined: Tue Jan 03, 2006 3:59 pm
Has thanked: 114 times
Been thanked: 422 times

Re: Program compiles in V3 but not in V4

Post by Steve »

I've looked into this and it reveals a small bug in the coversion of Flowcode programs. I'm going to quickly explain how I found the errors so that others can debug their own programs if necessary...

There are essentially 4 errors shown by the compiler messages. For example, the first error is:

Code: Select all

C:\Users\Wine Cellar I2C PIC18F452.c(2494:33): error: failed to generate expression
And this indicates an error in line 2494 of the C file. The other errors are on lines 6772, 6847, and 6922.

Looking at the C code generated by Flowcode, we can see the problem line:

Code: Select all

2492	//Is the fraction less than negative .9
2493	//Decision: DisplayValueFraction < - 9?
2494	if (FCV_DISPLAYVALUEFRACTION < - 9)
2495	{
The problem is with the "- 9". This needs to be entered without the space between the "-" and the "9". The other 3 errors are a similar problem.

Now we need to find where in the Flowcode flowchart these problems are. To do this, scroll up through the C code file until you get to the start of the function containing the error. In this case, the error is in this function:

Code: Select all

void FCM_DisplayDataValues()
This is the "DisplayDataValues" macro. Now it should be relatively easy to find the problematic icon - you can see the icon and the fix in the attached image.

In a similar way, you need to find the other 3 errors within the flowchart. They are all in the <MenuTempSetup> macro.

The bug is that statements like "x = - 9" need to be written as "x = -9".
Attachments
minus9error.jpg
minus9error.jpg (98.13 KiB) Viewed 3638 times

Zane
Flowcode v5 User
Posts: 199
Joined: Thu Sep 10, 2009 10:57 pm
Location: New Zealand
Has thanked: 93 times
Been thanked: 76 times

Re: Program compiles in V3 but not in V4

Post by Zane »

Hi Steve,

Thanks for your help, i will give your suggestion a try.

Post Reply