Compiler Error C2001 (Windows CE 5.0)

Send Feedback

newline in constant

A string constant cannot be continued on a second line unless you:

  • End the first line with a backslash.
  • Close the string on the first line with a double quotation mark and open the string on the next line with another double quotation mark.

Ending the first line with \n is not sufficient. For example:

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

Spaces at the beginning of the next line after a line-continuation character are included in the string constant. None of the examples shown above embed a newline character into the string constant. You can embed a newline character as shown here:

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

Send Feedback on this topic to the authors

Feedback FAQs

© 2006 Microsoft Corporation. All rights reserved.