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.

Compile Error Help?

Guru 15580 points

Pardon my newbie (to TI compiler) question, but can anyone give me some guidance on why the compiler doesn't like this:

 

 

 

#define MAX_PACKET 1024; 

unsigned char data[MAX_PACKET];

and gives the following error message:

Thx

MikeH

 

 

  • You have a semicolon after the 1024.

    The preprocessor blindly replaces any occurrence of "MAX_PACKET" with the rest of the line, thus when expanded you will have

      unsigned char data[1024;];

    You can use the -ppo compiler option to preprocess the code without compiling it, and look at the resulting .pp file to see how it expanded.

    It is also recommended to do

      #define MAX_PACKET (1024)

    to avoid accidental concatenation of the "1024" with its surroundings.

  • pf

    DOH!

    Many thanks,

    MikeH