[英]VS 2019 C++ compiler cant compile some strings
I have some strange and stupid situation.我有一些奇怪和愚蠢的情况。 I have this part of code:
我有这部分代码:
FString x = TEXT("ааааааа");//Russian language (line 54)
Caesar* ciph = new Caesar;// (line 55)
When I try to compile my project, I have such errors:当我尝试编译我的项目时,我遇到了这样的错误:
../Widget_Manager.cpp(54): error C2001: newline in constant
../Widget_Manager.cpp(54):错误 C2001:常量中的换行符
../Widget_Manager.cpp(55): error C2146: syntax error: missing ';'
../Widget_Manager.cpp(55):错误 C2146:语法错误:缺少 ';' before identifier 'Caesar'
在标识符“凯撒”之前
The most interesting thing (for me at least) that if I change 54 line on:最有趣的事情(至少对我来说)如果我改变 54 行:
FString x = TEXT("абвгдеё");//Russian language (line 54)
or或者
FString x = TEXT("abcdefg");//English language (line 54)
or if I delete 1 'a' from Russian "ааааааа".或者如果我从俄语“аааааа”中删除 1 个 'a'。 It's compile.
是编译。
Also I try hitting the keyboard in different ways, and I found other uncompiled letter combinations on Russian like: риорыва
and нкешшур
.此外,我尝试以不同的方式敲击键盘,并在俄语中发现了其他未编译的字母组合,例如:
риорыва
和нкешшур
。
It's work similary without TEXT()
macros.没有
TEXT()
宏,它的工作方式类似。
As I understand Russian language contains, beginning with UTF-16.据我了解,俄语包含,以 UTF-16 开头。 FStrigs is UTF-16.
FSrigs 是 UTF-16。 The only thing with which I can associate the behavior of the compiler is that (as far as I know) by default it works in the UTF-8 (whatever that means).
我唯一可以将编译器的行为与之关联的是(据我所知)默认情况下它在 UTF-8 中工作(无论这意味着什么)。
I would be glad if someone understand and can explain me what's going on.如果有人理解并可以向我解释发生了什么,我会很高兴。
I work in Visual Studio 2019, UE 4.26.1.我在 Visual Studio 2019,UE 4.26.1 中工作。
//////////////////////////////////////////////// ////////////////////////////////////////
Afterword:后记:
Problem was solved, but question: "Why some of Russian letter combination are compiled encoding while other combination are not compiled (on Cyrillic windows 1251)?"问题已解决,但问题是:“为什么某些俄语字母组合被编译编码而其他组合未编译(在西里尔字母 windows 1251 上)?” still remains.
仍然存在。
If you need UTF-16 string laterals, you can use statements like this:如果您需要 UTF-16 字符串横向,您可以使用如下语句:
char16_t str[] = u"Виян Лиже Первомай";
But, of course, it depends on implementation of FString class you use.但是,当然,这取决于您使用的 FString class 的实现。
To solve compilation problem, I File -> Save as -> near save button arrow -> Save with encodig -> Choose UTF-8
为了解决编译问题,我
File -> Save as -> near save button arrow -> Save with encodig -> Choose UTF-8
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.