如何解决ase库的algparam.h(322): error C2061错误

来源:互联网 发布:语音朗读小说软件 编辑:程序博客网 时间:2024/05/24 06:24

在使用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>          with1>          [1>              T=bool1>          ]1>          e:\work\driverexam\include\aes\algparam.h(329): 参见对正在编译的类 模板 实例化“CryptoPP::AlgorithmParametersTemplate<T>”的引用1>          with1>          [1>              T=bool1>          ]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);}


0 0