You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by xi...@apache.org on 2022/08/24 08:52:08 UTC

[incubator-nuttx] branch master updated: arch/sim/wchar_t: fix visual studio Compiler Error C2371

This is an automated email from the ASF dual-hosted git repository.

xiaoxiang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-nuttx.git


The following commit(s) were added to refs/heads/master by this push:
     new a93b703994 arch/sim/wchar_t: fix visual studio Compiler Error C2371
a93b703994 is described below

commit a93b7039949b1b90966d4593314d83a2beaa07fd
Author: chao.an <an...@xiaomi.com>
AuthorDate: Wed Aug 24 12:10:38 2022 +0800

    arch/sim/wchar_t: fix visual studio Compiler Error C2371
    
    type of 'wchar_t' confilt with vcruntime:
    
    C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.33.31629\include\vcruntime.h(228,28):
      error C2371: 'wchar_t': redefinition; different basic types
    D:\code\incubator-nuttx\include\sys/types.h(174): message : see decaration of 'wchar_t'
    
    typedef wchar_t as unsigned char to compatible with vcrtuntime
    
    Signed-off-by: chao.an <an...@xiaomi.com>
---
 arch/sim/include/types.h | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/arch/sim/include/types.h b/arch/sim/include/types.h
index da96532137..d347751567 100644
--- a/arch/sim/include/types.h
+++ b/arch/sim/include/types.h
@@ -88,6 +88,8 @@ typedef _uint64_t          _uintmax_t;
 
 #if defined(__WCHAR_TYPE__)
 typedef __WCHAR_TYPE__     _wchar_t;
+#elif defined(_MSC_VER)
+typedef unsigned short     _wchar_t;
 #else
 typedef int                _wchar_t;
 #endif