How to fix va_list/va_arg related C error 'expected expression before int'

Problem:

You have C code like

but when you try to compile it you see an error message like

Solution

This error occurs because va_arg is undeclared. Add

at the top of the source file where the error occured. This will include the definitions for va_list and the va_arg function.


Check out similar posts by category: C/C++, GCC Errors