Error Message “expected '=', ',', ';', 'asm' or '__attribute__' before 'typedef’” While Building a Project in PSoC Creator™- KBA222957

Version: **

 

Question:

The " expected '=', ',', ';', 'asm' or '__attribute__' before 'typedef' " error message appears while building a project in PSoC Creator™. How can I fix this issue?

 

Answer:

If you do not follow the syntax for lines of code before the include statement, Arm® GCC reports the error as occurring before the first line of the first include. Consider an example where an extra character ‘a’ is added to the first line of the code, in stdlib.h, as shown below:

 

a//sample

#include <stdlib.h>

#include <stdio.h>w

#include <string.h>


int main (int argc, char** argc) {}

 


In this example, GCC compiler will report a syntax error in stddef.h, which will be similar to the error message shown below:

To resolve the error, remove the extra character ‘a’.