Page 1 of 1

Compilation error

Posted: Mon Oct 22, 2012 3:38 pm
by Sefi
Hello everyone,

I get a compilation error on the attached custom component. The interesting thing is that if I exclude the last macro by setting the Macronames, Count to 14 it works but including the last macro (TFT_Char) I get the following error:
Flowcode1.c(460): error: missing right paren
Flowcode1.c(460): error: general error
Flowcode1.c(460): error: unexpected constant
Flowcode1.c(460): error: variable name expected
Flowcode1.c(460): error: general error
Flowcode1.c(460): error: variable name expected
Flowcode1.c(460): error: general error
Flowcode1.c(460): error: variable name expected
Flowcode1.c(460): error: general error
Flowcode1.c(460): error: variable name expected
Flowcode1.c(460): error: general error
Flowcode1.c(460): error: variable name expected
Flowcode1.c(460): error: general error
Flowcode1.c(460): error: failure
although it is unlikely that the code will win any awards for anything ;-), I cant see what is wrong, as the error message seems misleading and is probably connected to some other issue.

any help would be greatly appreciated.

many thanks
Sefi

Re: Compilation error

Posted: Mon Oct 22, 2012 4:30 pm
by JonnyW
Hello. Your error is in Flowcode1.c, not FC5_PIC_Custom2.c. Could you post this file so we can see what line the error is on?

One thing I do notice in your custom code is that you have an array of 784 elements. The PIC only supports arrays of 256 bytes or less - the size of one page of memory. You may need to break this up into multiple sub-arrays to get this working.

Cheers,

Jonny

Re: Compilation error

Posted: Mon Oct 22, 2012 4:50 pm
by Sefi
Thanks Jonny,

many thanks for taking a look at this.

Sefi

Re: Compilation error

Posted: Mon Oct 22, 2012 4:57 pm
by Sefi
I have now split the array holding the bitmap definitions of the characters into 3 separate arrays of 256 bytes each. There is a restriction by the compiler which says you cant have arrays bigger than 256 bytes and "apparently" this can be overcome by adding the following directive to the compiler parameter line "-idx 2". I have tried this and maybe I am doing something wrong but I couldnt get it to work.

I have attached the changed custom component file here and still get the same error.

many thanks
Sefi

Re: Compilation error

Posted: Mon Oct 22, 2012 5:22 pm
by JonnyW
Hi. No problems. In the directory where Flowcode1.fcf is there is a generated C file called Flowcode1.c. Can you post this C file (not the FCF)?

From the error it looks like you have a missing semi-colon or end bracket somewhere in your code. By posting the Flowcode1.c file we will be able to see what the compiler doesn't like on line 490.

Cheers,

Jonny

Re: Compilation error

Posted: Mon Oct 22, 2012 5:41 pm
by medelec35
I would like to add to Jonnys post that missing semicolon can also be caused by a component not connected to pin when it should be.

For intance when a Keypad component on the control panel is showing unconnected instead of port B1 for any of its connections.

Martin

Re: Compilation error

Posted: Mon Oct 22, 2012 6:10 pm
by Sefi
Thanks Jonny and Martin,

I have attached the C file for your perusal.

Thank you for taking the time to look at it.

Re: Compilation error

Posted: Mon Oct 22, 2012 6:17 pm
by Sefi
Jonny,

the error is on line 371 which is the last of the Macro Functions declarations. The interesting thing is that if I exclude the last subroutine TFT_Char by setting the macro numbers to 14 in the custom components file, then it all works and the LCD functions correctly. There must be some issue with the last subroutine which I cant see.

thank you
Sefi

Re: Compilation error

Posted: Mon Oct 22, 2012 6:46 pm
by JonnyW
Hello. I believe BoostC defines 'C' - probably as nothing to indicate a C compiler (C++ compilers use this sometimes). You are using C as the first argument of your function.

You could either add the line '#undef C' somewhere above your prototype or (probably better) use a different name than 'C'. This should fix your code.

Cheers,

Jonny

Re: Compilation error

Posted: Mon Oct 22, 2012 6:57 pm
by Sefi
Jonny,

A huge thank you. Absolutely brilliant. That fixed it. :-)

Sefi