gpt4 book ai didi

c++ - cstdlib 无法使用::wcstombs 解析

转载 作者:行者123 更新时间:2023-12-04 15:07:15 36 4
gpt4 key购买 nike

我将我的系统升级到 fedora 33,之后我发现 stdlib.h 无法解析某些数据结构:

In file included from /usr/include/c++/10/cstdlib:75,
from /usr/include/c++/10/ext/string_conversions.h:41,
from /usr/include/c++/10/bits/basic_string.h:6545,
from /usr/include/c++/10/string:55,
from /home/ideepika/ceph5/ceph/src/rocksdb/include/rocksdb/cache.h:27,
from /home/ideepika/ceph5/ceph/src/rocksdb/cache/clock_cache.h:12,
from /home/ideepika/ceph5/ceph/src/rocksdb/cache/clock_cache.cc:10:
/usr/include/stdlib.h:935:5: error: expected initializer before ‘__attr_access’
935 | __attr_access ((__read_only__, 2));
| ^~~~~~~~~~~~~
/usr/include/stdlib.h:940:3: error: expected initializer before ‘__attr_access’
940 | __attr_access ((__write_only__, 1, 3)) __attr_access ((__read_only__, 2));
| ^~~~~~~~~~~~~
/usr/include/stdlib.h:994:30: error: expected initializer before ‘__attr_access’
994 | __THROW __nonnull ((2)) __attr_access ((__write_only__, 2, 3));
| ^~~~~~~~~~~~~
In file included from /usr/include/c++/10/ext/string_conversions.h:41,
from /usr/include/c++/10/bits/basic_string.h:6545,
from /usr/include/c++/10/string:55,
from /home/ideepika/ceph5/ceph/src/rocksdb/include/rocksdb/cache.h:27,
from /home/ideepika/ceph5/ceph/src/rocksdb/cache/clock_cache.h:12,
from /home/ideepika/ceph5/ceph/src/rocksdb/cache/clock_cache.cc:10:
/usr/include/c++/10/cstdlib:154:11: error: ‘mbstowcs’ has not been declared in ‘::’
154 | using ::mbstowcs;
| ^~~~~~~~
/usr/include/c++/10/cstdlib:171:11: error: ‘wcstombs’ has not been declared in ‘::’
171 | using ::wcstombs;
| ^~~~~~~~

错误的来源仅仅是因为#include,因此来自 rocksdb 的源代码看起来并不可疑。

正在调查...将更新相关细节,如果需要添加更多细节请告诉我

最佳答案

原来有最近的补丁添加到 cstdlib:https://www.cygwin.com/bugzilla/attachment.cgi?id=12133

这可能没有被捕获,我现在没有调查相关文件,但是如果其他人碰到这个问题,添加最小更改补丁集......

diff --git a/stdlib.h b/stdlib.h
index f255e4a..d88ef89 100644
--- a/stdlib.h
+++ b/stdlib.h
@@ -931,10 +931,11 @@ extern int wctomb (char *__s, wchar_t __wchar) __THROW;

/* Convert a multibyte string to a wide char string. */
extern size_t mbstowcs (wchar_t *__restrict __pwcs,
- const char *__restrict __s, size_t __n) __THROW
+ const char *__restrict __s, size_t __n) __THROW;
/* Convert a wide char string to multibyte string. */
extern size_t wcstombs (char *__restrict __s,
- const wchar_t *__restrict __pwcs, size_t __n) __THROW
+ const wchar_t *__restrict __pwcs, size_t __n)
+ __THROW;

#ifdef __USE_MISC
/* Determine whether the string value of RESPONSE matches the affirmation
@@ -988,7 +989,7 @@ extern char *ptsname (int __fd) __THROW __wur;
terminal associated with the master FD is open on in BUF.
Return 0 on success, otherwise an error number. */
extern int ptsname_r (int __fd, char *__buf, size_t __buflen)
- __THROW __nonnull ((2))
+ __THROW __nonnull ((2));

关于c++ - cstdlib 无法使用::wcstombs 解析,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/65885550/

36 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com