简体   繁体   English

错误C2308:连接不匹配的字符串

[英]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. 在尝试在Visual Studio 2010中的rosettacode中编译C中Maze Generator / Solver时 ,我在编译期间遇到问题。

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 考虑到我对Unicode的有限知识,以及对MSDN中错误的不友好描述,我对这个问题以及如何解决它感到困惑

You need to escape the " s in the wide string literal: 你需要转义宽字符串文字中的" s "

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

EDIT: 编辑:

I missed the SPC macro (as already posted by Luchian and jrok): 我错过了SPC宏(已经由Luchian和jrok发布):

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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