gcc "warning: multi-character character constant" treated as error in CI
Single quotes denote one character. Writing more than one character inside them, like 'ab', makes a multi-character constant with implementation-defined value, which -Wmultichar warns about and -Werror turns into a failure.
What this error means
A build with -Werror stops at a literal that uses single quotes around several characters, frequently a string that should use double quotes.
gcc
main.c:4:13: error: multi-character character constant [-Werror=multichar]
4 | int x = 'abcd';
| ^~~~~~Common causes
How to fix it
Use double quotes for strings
- Change the single quotes to double quotes when you meant a string.
- Rebuild to confirm the warning is gone.
C
const char *s = "abcd"; /* not 'abcd' */Silence intentional multichar locally
If the packed constant is deliberate, disable just -Wmultichar for that file rather than dropping -Werror everywhere.
gcc
gcc -Wno-multichar -c fourcc.cHow to prevent it
- Reserve single quotes for one character and use double quotes for strings; only suppress -Wmultichar where a packed multi-character constant is intended.
Related guides
clang "error: call to undeclared function; ISO C99 ... implicit declarations" in CIFix clang "error: call to undeclared function ...; ISO C99 and later do not support implicit function declara…
clang "warning: unused variable X [-Wunused-variable]" fails CIFix clang "unused variable X [-Wunused-variable]" promoted to an error in CI - a local variable is declared b…