Crypto++ 在 algparam.h 中给出编译器错误

2023-12-25

我在一个相当大的文件中有以下几行:

#include <sha.h>
#include <hex.h>

编译时,会抛出以下编译器错误:

1>d:\work\app\tools\cryptopp\algparam.h(322): error C2061: syntax error : identifier 'buffer'
1>          d:\work\app\tools\cryptopp\algparam.h(321) : while compiling class template member function 'void CryptoPP::AlgorithmParametersTemplate<T>::MoveInto(void *) const'
1>          with
1>          [
1>              T=bool
1>          ]
1>          d:\work\app\tools\cryptopp\algparam.h(329) : see reference to class template instantiation 'CryptoPP::AlgorithmParametersTemplate<T>' being compiled
1>          with
1>          [
1>              T=bool
1>          ]

我很确定我忘记了一些事情,但我不确定是什么。如果我不包含 hex.h,则不会有任何问题,并且我会得到 SHA256 哈希值,但当我包含 hex.h 时,会弹出错误。

Edit

如果有人想知道,来自 Crypto++ 工具包的 algparam.h:

void MoveInto(void *buffer) const //<=== line 320
{
    AlgorithmParametersTemplate<T>* p = new(buffer)
    AlgorithmParametersTemplate<T>(*this);
}

CRYPTOPP_DLL_TEMPLATE_CLASS AlgorithmParametersTemplate<bool>; // <== line 329

Edit: 删除了无关的代码


我通过暂时取消定义解决了这个问题new,它被定义为一些额外调试代码的宏。

#pragma push_macro("new")
#undef new
/* #includes for Crypto++ go here */
#pragma pop_macro("new")
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

Crypto++ 在 algparam.h 中给出编译器错误 的相关文章

随机推荐