2012年2月2日 星期四

[WebKit] error C2001: newline in constant

Error Message:
error C2001: newline in constant f:\WebKit\Source\WebCore\platform\DefaultLocalizationStrategy.cpp

Cause:
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: 
End the first line with the line-continuation character, 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. 
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 "); 

Solution:
Removing the  “ and ” symbols surrounding %@ and <selection> in the following line would fix the bug
"Look Up “%@”"
"Look Up “<selection>”"


Reference:
https://bugreports.qt-project.org/browse/QTBUG-23590

沒有留言:

張貼留言