[英]Identifier wchar_t is undefined
我添加了这两行并解决了问题,
#undef _WCHAR_T_DEFINED
#include<stddef.h>
但是,我不确定这是否是最佳更改。
因此,此更改是在了解@keith 告诉我需要为 C 添加 wchat_t 之后进行的。进一步调查以了解编译器级别的行为和可用的标志。 要知道为什么我添加了宏的 undef,请阅读下面的链接,
https://learn.microsoft.com/en-us/cpp/build/reference/zc-wchar-t-wchar-t-is-native-type?view=vs-2019
https://github.com/microsoft/clang-1/blob/master/test/Driver/cl-zc.cpp
简而言之,
// RUN: %clang_cl /c -### /Zc:wchar_t -- %s 2>&1 | FileCheck -check-prefix=WCHAR_T-ON %s
// WCHAR_T-ON-NOT: argument unused during compilation
// RUN: %clang_cl /c -### /Zc:wchar_t- -- %s 2>&1 | FileCheck -check-prefix=WCHAR_T-OFF %s
// WCHAR_T-OFF: argument unused during compilation
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.