Compiler Error C2001

newline in constant

A string constant was continued on a second line without either a backslash (\) or closing and opening double quotation marks (").

To break a string constant that is on two lines in the source file, do one of the following:

It is not sufficient to end the first line with \n, the escape sequence for embedding a newline character in a string constant.

The following are examples of incorrect and correct usage:

printf("Hello,             // error
    world");
printf("Hello,\n          //  error
    world");
printf("Hello,\           //  OK
 world");
printf("Hello,"            // OK
    " world");

Note that any spaces at the beginning of the next line after a line-continuation character are included in the string constant and that neither solution actually places a newline character into the string constant. The following examples embed this character:

printf("Hello,\n\
world");
printf("Hello,\
\nworld");
printf("Hello,\n"
    "world");
printf("Hello,"
 "\nworld");