Solutions to error c2143: syntax error: missing ‘;’ before ‘type’ in C + + program compilation

People make the rules. Why didn’t I know about QAQ?(> The man & lt; ). ~ Purr…
In pure C, variable declarations must come first in a block of code

    found a problem when running the program, VC 6.0 compiler C language is always prompted with an error: error C2143: syntax error: missing ‘; ‘before’ type ‘. The solution is to put the declaration of all variables before the executable code. The problem occurs because the file is saved in.c format. It will compile normally if it is in CPP format. If you change it to.cpP, it will work, regardless of where your variable is declared. * Generally in ANSI C or C++, it is allowed to define variables at any time in executable code, but in K& It’s not allowed in R C, and that’s why we have this error. VC6.0, VS2008 are used K& R C to implement the C language, so the compilation process will report errors. No such File or Directory appears about C free 5. Wait for a few mistakes to appear together. Solution: If the name of the installation directory has Spaces, the system may not find the path.
    we can try to change the name of the installation directory to simple, no Spaces.

I am so happy that the problem that has been bothering me has been solved. Only in the process of solving the problem can I feel that kind of happiness. I hope it will be helpful to those who have the same problem.
Wrote by markpain 20160908

Read More: