# C2143 in cstdio

It is rather interesting when the standard library returns compile errors:
[md] 3>c:\program files (x86)\microsoft visual studio 9.0\vc\include\cstdio(39) : error C2143: syntax error : missing ‘{‘ before ‘:’
3>c:\program files (x86)\microsoft visual studio 9.0\vc\include\cstdio(39) : error C2059: syntax error : ‘:’
[/md]

This C2143 error is caused by the inclusion of C++ code within a .c file. Renaming the file from *.c to *.cpp will solve the compile error. However, in some circumstances it is not ideal to rename the file. Then the error can be solved by instructing Visual Studio to compile the project as C++ with the `/TP` option.

When we look at the project’s properties, we can see the project is already set to compile as C++:

The occurrence of the compile error while the flag is set is due to the default arguments not triggering the same behaviour as when the same argument value is manually specified. Selecting another option and then manually setting the same `/TP` compile flag solves the compile error: