简体   繁体   English

VS 2019 C++ 编译器无法编译某些字符串

[英]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.

相关问题 Code::Blocks 和 C++ 编译器问题。 无法编译头文件 - Code::Blocks, and C++ Compiler problem. cant compile a header VS2019:编译 Cap'nProto 使 C++ 编译器崩溃 - VS2019: Compiling Cap'nProto Crashes C++ Compiler 如何在 VS2019 中为 C++ 字符串设置条件断点? - How to set a conditional breakpoint for C++ strings in VS2019? 安装 VS 2019 后,CMake 找不到 VS 2017 C++ 编译器 - CMake does not find VS 2017 C++ compiler after installation of VS 2019 用C ++无法编译cython - Cant compile cython with c++ 在 Windows 10 上使用 VS2019 的 Linux (Raspbian) 中的 C/C++ 线程 -pthread - 无法编译 - C/C++ Threading in Linux (Raspbian) using VS2019 on Windows 10 -pthread - Can't compile VS2019 Linux C++:未定义引用“dlopen”,g++ -ldl 编译器标志未应用 - VS2019 Linux C++: undefined reference “dlopen”, g++ -ldl compiler flag not applied VS2019 | C++ | 共享指针 | 编译器警告:指针指向堆栈上分配的 memory - VS2019 | C++ | Shared Pointers | Compiler Warning: The pointer points to memory allocated on the stack 我可以在 VS2019 中使用旧的次要版本的 C++ 编译器吗? - Can I use older minor version of C++ compiler in VS2019? 如何在 Windows-10 (VS 2019) 中编译 Apache Arrow Flight C++ 示例 - How to compile Apache Arrow Flight C++ example in Windows-10 (VS 2019)
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM