我在一个相当大的文件中有以下行:
#include <sha.h>
#include <hex.h>
Run Code Online (Sandbox Code Playgroud)
在编译时会抛出此编译器错误:
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> ]
Run Code Online (Sandbox Code Playgroud)
我很确定我忘了什么,但我不确定是什么.如果我不包含hex.h,我没有任何问题,我得到一个SHA256哈希就好了,但是当我包含hex.h时,会弹出错误.
编辑
如果有人想知道,来自alpparam.h的Crypto ++工具包:
void MoveInto(void *buffer) const //<=== line 320
{
AlgorithmParametersTemplate<T>* p = new(buffer)
AlgorithmParametersTemplate<T>(*this);
}
CRYPTOPP_DLL_TEMPLATE_CLASS AlgorithmParametersTemplate<bool>; // <== line 329
Run Code Online (Sandbox Code Playgroud)
编辑:删除不相关的代码
我通过暂时取消定义来修复问题new,这被定义为一些额外调试代码的宏.
#pragma push_macro("new")
#undef new
/* #includes for Crypto++ go here */
#pragma pop_macro("new")
Run Code Online (Sandbox Code Playgroud)