【发布时间】:2018-05-05 18:46:00
【问题描述】:
在使用 Crypto++ 编译游戏时,我遇到了与 Crypto++ giving a compiler error in algparam.h 相同的错误。错误是:
Error C2061: syntax error : identifier 'buffer' (at line 397)
这里是代码。它从第 390 行开始,到第 411 行结束。
#if defined(DEBUG_NEW) && (_MSC_VER >= 1300)
# pragma push_macro("new")
# undef new
#endif
void MoveInto(void *buffer) const
{
AlgorithmParametersTemplate<T>* p = new(buffer) AlgorithmParametersTemplate<T>(*this);
CRYPTOPP_UNUSED(p); // silence warning
}
#if defined(DEBUG_NEW) && (_MSC_VER >= 1300)
# pragma pop_macro("new")
#endif
protected:
T m_value;
};
CRYPTOPP_DLL_TEMPLATE_CLASS AlgorithmParametersTemplate<bool>;
CRYPTOPP_DLL_TEMPLATE_CLASS AlgorithmParametersTemplate<int>;
CRYPTOPP_DLL_TEMPLATE_CLASS AlgorithmParametersTemplate<ConstByteArrayParameter>;
有什么问题,我该如何解决?
这是我使用的库:
- 提升 1.67(也试过 1.63)
- sqlapi++
- 营地
- mysqlcppconns
这是错误信息:
1>c:\local\cryptopp\algparam.h(397): error C2061: syntax error: identifier 'buffer'
1>c:\local\cryptopp\algparam.h(396): note: while compiling class template member function 'void CryptoPP::AlgorithmParametersTemplate<CryptoPP::ConstByteArrayParameter>::MoveInto(void *) const'
1>c:\local\cryptopp\algparam.h(411): note: see reference to class template instantiation 'CryptoPP::AlgorithmParametersTemplate<CryptoPP::ConstByteArrayParameter>' being compiled
【问题讨论】:
-
您使用的是什么版本的库?你是如何建造图书馆的?你是如何编译和链接你的程序的?
-
我在游戏中使用
cryptopp 7.0 - Debug Mode。在编译中,我使用了所有这些库:boost 1.67 (tried 1.63 too), sqlapi++, camp, mysqlcppconns。由于源文件不是我的,所以我有很多警告,但所有这些警告都可以。如果需要,这是 github 的链接:Click Here -
好吧,我不确定问题出在哪里。您可能应该从显示完整错误开始,而不仅仅是“错误 C2061:语法错误:标识符 'buffer'(第 397 行)”。我想您需要将其减少到minimal, complete, and verifiable example。如果我不得不冒险猜测,那是意外的编译器切换或与其他库之一的异常交互。
标签: c++ boost compilation crypto++ mysqlconnection