This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

Missing bracket issue in CCSv4

Good afternoon,

I'm trying to write a driver for the HD4478 LCD, but when I try to compile the proyect, a 'expected a ")"' appears in one of the function declarations. The odd thing is, there is a ) already placed. This can be seen in the line 129 of the .c file, and line 20 of the .h file. Any help is appreciated.

Best regards.

  • It's not a good idea to use single characters as variable names.

    Besides not being very 'telling', it bears the risk of using somehting that may have a special meaning.

    I'm not 100% sure, bit it may be that 'B' denotes a binary value number (even though there are no digits) and the compiler tells you that before you can put a number, you should close the function definition. It expects the closing bracked before the B, not after it. Because you and the compiler have different ideas about what 'B' could be.

    Programmers rule: lazyness doesn't pay. So give functions and variables 'telling' names.

  • Done, changed the whole function variables to a more descriptive name. Now it compiles.

    Thank you!

  • Lesson to learn:

    Jos�� Moreno said:
    'expected a ")"' appears in one of the function declarations. The odd thing is, there is a ) already placed.

    Whenever you get a situation like that, it is almost invariably because the compiler has got "out-of-step"  due to some mistake earlier in the code - so the approach to resolve the issue is to work backwards, looking very carefully for the mistake which caused the compiler to get "out-of-step"...

    In particular, one error often leads to another - so always address the first error first, and see how many that clears-up.

    This is general to any 'C' programming (and, in fact, any programming in any languages) - not specific to TI or the MSP.

  • Andy Neil said:
    the approach to resolve the issue is to work backwards, looking very carefully for the mistake which caused the compiler to get "out-of-step"...

    However, in this case it was on the same line and the brackets appeared correct.
    Nobody could see from a simple look on teh code that 'B' would be interpreted as '0' and cause the compiler to want a closing bracket before it.

  • Jens-Michael Gross said:
    However, in this case it was on the same line

    Of course, "work backwards" does include examining the preceding text on the same line.

    Jens-Michael Gross said:
    and the brackets appeared correct

    If the compiler says, "bracket expected" when there's already a bracket, that would mean it's expecting another bracket!

    I do quite often find that mistakes in function declarations often give rise to the compiler complaining that it expected (aother) bracket...

    Jens-Michael Gross said:
    Nobody could see from a simple look on teh code that 'B' would be interpreted as '0'

    Indeed!

    'B' as a binary number indicator would be a very non-standard extension. Maybe there's a macro somewhere...?

    Examining the preprocessor output can be enlightening for that sort of thing...

     

  • Andy Neil said:
    'B' as a binary number indicator would be a very non-standard extension

    Indeed. Teh C++ standard does not define binary numbers at all. Only octal (leading '0') and hex (leading '0x').

    Latest GCC seems to support '0b' for binary (MSPGCC3.2.3 doesn't at all - I wrote a macro that turns a 'binary' token into a value)

    I don't know for CCS and IAR. However, since it isn't defined how it has to be, and I dimly remembered seeing it before...
    But you're right, it could have been a macro too. Then even A or C could have been the culprit.

    It would be interesting to see the preprocessor output.

**Attention** This is a public forum