gpt4 book ai didi

libgcrypt v1.5.0 的编译器警告

转载 作者:太空宇宙 更新时间:2023-11-04 02:13:32 27 4
gpt4 key购买 nike

当我编译一个定义了 GCRYPT_NO_DEPRECATED 的示例程序时,我收到以下 6 条警告:

/usr/local/Cellar/libgcrypt/1.5.0/include/gcrypt.h:1336: warning: ‘gcry_ac_io_mode_t’ is deprecated
/usr/local/Cellar/libgcrypt/1.5.0/include/gcrypt.h:1337: warning: ‘gcry_ac_io_type_t’ is deprecated
/usr/local/Cellar/libgcrypt/1.5.0/include/gcrypt.h:1344: warning: ‘gcry_ac_data_read_cb_t’ is deprecated
/usr/local/Cellar/libgcrypt/1.5.0/include/gcrypt.h:1358: warning: ‘gcry_ac_data_write_cb_t’ is deprecated
/usr/local/Cellar/libgcrypt/1.5.0/include/gcrypt.h:1393: warning: ‘gcry_md_algo_t’ is deprecated
/usr/local/Cellar/libgcrypt/1.5.0/include/gcrypt.h:1401: warning: ‘gcry_md_algo_t’ is deprecated

手动定义 _GCRYPT_IN_LIBGCRYPT 解决了 6 个警告,但手册在劝告方面相当严格:

name prefixes with one prepended underscore are reserved for internal use and should never be used by an application.

那么应该如何在没有警告的情况下编译 gcrypt header ?

最佳答案

gcrypt 作者说,“这是某些编译器中的错误”

建议的解决方法是

#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
before the include, and
#pragma GCC diagnostic warning "-Wdeprecated-declarations"

http://lists.gnupg.org/pipermail/gcrypt-devel/2011-July/001829.html

http://lists.gnupg.org/pipermail/gcrypt-devel/2011-July/001830.html

关于libgcrypt v1.5.0 的编译器警告,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10556299/

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