简体   繁体   中英

error C2308: concatenating mismatched strings

While trying to compile the Maze Generator/Solver in C as present in rosettacode in Visual Studio 2010, I am facing issue during compilation.

The following line

#   define SPC " "
wchar_t glyph[] = L""SPC"│││─┘┐┤─└┌├─┴┬┼"SPC"┆┆┆┄╯╮ ┄╰╭ ┄";

is throwing an Error

1>d:\projects\maze_cpp\maze_cpp\main.cpp(14): error C2308: concatenating mismatched strings
1>          Concatenating wide "" with narrow "?????? ??? ?"

Considering my limited knowledge with Unicode, and the unfriendly description of the error in MSDN , I am puzzled about the problem and how to solve it

You need to escape the " s in the wide string literal:

wchar_t glyph[] = L"\"SPC\"¦¦¦-++¦-+++---+\"SPC\"?????? ??? ?"; 

EDIT:

I missed the SPC macro (as already posted by Luchian and jrok):

#define SPC L"  "
wchar_t glyph[] = L"" SPC L"¦¦¦-++¦-+++---+" SPC L"?????? ??? ?";

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM