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.

directive #elif

Other Parts Discussed in Thread: OMAPL138

 

in code composer studio 5.3 the directive line

#elif

has question mark in the left margin saying expression synatx error

but the project compiles and builds without any error.

Is this a mistake in the editor tool reserved words?

  • Hatem,

    The ? is correctly telling you that your syntax is incorrect. Please look in your C language manual to see the proper syntax for the #elif directive.

    The following compiles and displays correctly with no ? displayed:

    #if TESTVAL == 1
     printf("Hello World 1!\n");
    #elif TESTVAL == 2
     printf("Hello World 2!\n");
    #else
     printf("Hello World 3!\n");
    #endif

    Best of luck with your work with the C language. I am glad your code compiles correctly, and you can be glad that the CCS editor window shows you when you syntax errors.

    Regards,
    RandyP

  • Hi RandyP

    Thanks for the detailed reply.

    The code was from an example from TI.  Not from me.

    But the code compiles and builds OK in CCS.  It is just displaying the ? mark.

    So How the syntax is wrong and yet the code compiles and builds OK in CCS?

     

    Regards

    Hatem

     

  • Hatem,

    Would you please tell us which exact example and which file and line this is found? We will need to know the device and the software version numbers in case the example is different in older or newer releases, please.

    There can be many warnings generated by the compiler showing problems with how something is written, but the compiler will still generate code for it. Sometimes the compiler still does what you wanted it to do, and sometimes the compiler does something different that causes problems in your testing. This is why I try to avoid having any warnings, and like you I try to get rid of those cases where warnings show up.

    Your help in pointing us to this mistake in our code is appreciated.

    Regards,
    RandyP

  • Hi RandyP

    Here is screen shot for the project  TIMER_interrupt_dspL138

     

     

    Hatem

  • Can you let us know which software package contains this example? Is it Starterware or the BIOS SDK or some other package? We'd like to see if we can duplicate the syntax error with the same example. One thing to check is if the error still apepars if you import the project into a clean new workspace.

    Also, as you already understood, the error is coming from the CCS code analysis tool and is not a compiler error so your code itself should be getting built fine.

  • My guess would be that

    #elif OMAPL138

    should be

    #elif defined(OMAPL138)

    Or that OMAPL138 should be given a value of 1 when defined.

  • Hatem,

    Another way to state what Norman Wong has said is that there is a requirement for this software to have either OMAPL137=1 or OMAPL138=1 defined in your compiler build properties. Since it appears that you are using the OMAPL138, then you need to add "OMAPL138=1" to your predefined symbols in your CCS compiler build properties.

    That information is probably documented somewhere with the library you are using, but all that really matters is that this needs to be done. Please let us know if that improves you screen warning. It should also improve the operation of your system since the OMAPL138_common.h file needs to be included, but it does not appear to be included.

    Regards,
    RandyP

  • Hi Randy & Norman

    It helps

    Thanks for the comments.