C/C++ 错误: format not a string literal and no format arguments [-Werror=format-security] 解决方法
The error message 'format not a string literal and no format arguments [-Werror=format-security]' indicates that there is an issue with a format string in your C/C++ code. This error often occurs when you are using a format string without providing the necessary arguments.
To fix this error, you need to ensure that you are providing the appropriate arguments for the format string. Make sure that the number and types of arguments match the format placeholders in the string.
For example, if you have a format string like this:
char* name = 'John';
printf('Hello, %s'); // Incorrect: missing argument for %s
You need to provide the missing argument for the %s placeholder:
char* name = 'John';
printf('Hello, %s', name); // Correct: providing the missing argument
By providing the missing argument, the error should be resolved.
原文地址: https://www.cveoy.top/t/topic/peSq 著作权归作者所有。请勿转载和采集!