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.

CCSv4 At end of source: error: expected a "}"

Hello,

I am trying to complile a program using the compiler for a DSP2803x using CCSv4. I am trying to use embedded C++ and the compiler is failing.

1st: Does the C2000 compiler support C++?

I am getting the following errors/warnigs:

I am also working with a Stellaris micro and have the same C++ setting but no warnings/errors. Also is there startup code associated with running a C2000?

"../Application/Main_main.cpp", line 109: warning: linkage specification is not allowed

At end of source: error: expected a "}"

1 error detected in the compilation of "../Application/Main_main.cpp".

Can someone please help me solve these problems?

Thank you,

Luke

 

  • First answer: Yes the compiler does support C++.

    As for the error:

    This looks like it is caused by an unbalanced { } set.  Go through your code to check if all your loops and functions are bounded properly.

    As for the warning:

    Please post the code on line 109 (where the warning is) so we are able to help

    Thanks

     

    Tim

  • plz help me out....i am unable to debug the code...kindly go through the code and let me know if any errors are der..my code shows the same error..(#68 expected a "}')
    #include "msp430x22x4.h"

    void initiateclocks();
    volatile unsigned int i; // volatile to prevent optimization

    void main(void)
    {
    WDTCTL = WDTPW + WDTHOLD; // Stop watchdog timer
    initiateclocks();
    P1DIR |= 0x01; // Set P1.0 to output direction

    for (;;)
    {
    P1OUT ^= 0x01; // Toggle P1.0 using exclusive-OR
    i = 50000; // Delay
    do (i--);
    while (i != 0);
    }

    void initiateclocks()
    {
    BCSCTL1 = CALBC1_8MHZ;
    DCOCTL = CALDCO_8MHZ;
    // Set LFXT1 to the VLO @ 12kHz
    BCSCTL3 |= LFXT1S_2;
    }
  • Hi Sri,

    The compiler is providing you a helpful (and relatively descriptive) error.  You will need to debug your code to find what is causing the error.

    PS: You have posted your question in the C2000 forum.  MSP430 questions should be posted in the MSP forum. 


    Thank you,
    Brett

  • It looks like you do not have a closing bracket at the end of main. You close the for loop, but do not close main before you define initiateclocks().

    -Mark

  • thnks Brett...i got it..