在使用ase库的时候我遇到了一个编译错误,错误如下:
>e:\work\driverexam\include\aes\algparam.h(322): error C2061: 语法错误: 标识符“buffer”
1> e:\work\driverexam\include\aes\algparam.h(321): 编译类 模板 成员函数“void CryptoPP::AlgorithmParametersTemplate<T>::MoveInto(void *) const”时
1> with
1> [
1> T=bool
1> ]
1> e:\work\driverexam\include\aes\algparam.h(329): 参见对正在编译的类 模板 实例化“CryptoPP::AlgorithmParametersTemplate<T>”的引用
1> with
1> [
1> T=bool
1> ]
1>
1>生成失败。在谷歌上查询发现是调试器在调试的时候使用了new关键字参考网址:http://stackoverflow.com/questions/15203562/crypto-giving-a-compiler-error-in-algparam-h
解决方法:在包含头文件的时候添加如下的宏就可以了。
#pragma push_macro("new")
#undef new
#include "AESCryptor.h"
#pragma pop_macro("new")
#include <string>
using namespace std;
void CaseLibTestDlg::OnBnClickedButton1()
{
// TODO: 在此添加控件通知处理程序代码
AESCryptor tt;
string plain ="hello";
string en = tt.Encrypt(plain);
string p = tt.Decrypt(en);
}
本文介绍了在使用ASE库过程中遇到的一个编译错误,并详细解释了如何通过简单的宏定义来解决这一问题。此外,还提供了具体的代码示例,帮助读者快速定位并解决类似错误。
917

被折叠的 条评论
为什么被折叠?



