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.

CCS/MSP430FR5994: common for loop increment variables not being initialized unless declared before the loop

Part Number: MSP430FR5994


Tool/software: Code Composer Studio

Hi All

so I have been working on code that works as modules independently however when I bring working modules together once I attempt to build the project I am getting error saying my for loop increment variables are not initialized. below is a snap shot of the code and you can see where it is throwing errors around. I am wondering if I am not including some library or something or perhaps my syntax is wrong however they are simple basic for loops so I cannot see any actual errors with the code it self. nor do my switch statements work. The one thing I have noticed is in fact that every single for loop in the entire program has thrown the same error as has the switch statements claiming the the variables apart of the construction of the loops and switches are not initialized. Is this something to do with a library not included or a c99 version type of error? any advice would be helpful I would post the whole program but as I have written the loops they really shouldn't be affected.

  • Hi Chad,

    please delete the brackets () in line 242 and try again. This is only required if you call the function or declare it but not when you define it.

    Try again and let me know if it helped.

  • @Dietmar Walther  so like declare it at the top  like void synchp () ; and then define it later as synchP { } ? I tried what I just explained but it did not help it stopped recognizing the definition as a function, and some of my functions are fed variables so  would I declare like int reset4Move ( int alph, int beta) ; and define later as reset4Move {} ? I have always done them as a declare and define in one move is there a reason I should avoid this ? And It still reads the for loops with a variable not defined error.

  • What do the error messages actually say? (The first one is probably the most interesting one.)

    I rarely use this construct, but I vaguely recall it appeared around C99. You can select the C dialect using "Build Settings->Compiler->Advanced->Language->C Dialect".

    The triangle on the function declaration is presumably a Warning that you haven't provided an argument prototype. (Prototypes have been around since C89.) Change that line to "void SynchP(void){"

  • Hi,

    did you resolve the problem, if not please post the error messages to further help.

**Attention** This is a public forum