1

当我使用定义编译示例程序时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 个警告,但该手册的劝告相当严格:

带有一个前置下划线的名称前缀是为内部使用而保留的,绝不应该被应用程序使用。

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

4

1 回答 1

3

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

于 2012-10-10T23:53:07.510 回答