error C2485: 'align' : unrecognized extended

来源:百度知道 编辑:UC知道 时间:2024/05/04 17:07:58
__declspec (align(4)) DWORD dword_6AED28[1] ={0};
__declspec (align(4)) DWORD dword_6AED2C[0xFF] ={0};
__declspec (align(4)) DWORD dword_6AF128[0x100]={0};
__declspec (align(4)) DWORD dword_6AF528[0x100]={0};
__declspec (align(4)) DWORD dword_6AF928[0x100]={0};
__declspec (align(4)) DWORD dword_6AFD28[1] ={0};
__declspec (align(4)) DWORD dword_6AFD2C[0xFF] ={0};

// ------------------------------- 游戏内加密算法 -- blowfish ------------------------
__declspec(naked) void Blowfish_encipher()

编译器提示错误\Compiling...
Crypto.cpp
D:\work\bot\Src\Crypto.cpp(469) : error C2485: 'align' : unrecognized extended attribute
D:\work\bot\Src\Crypto.cpp(469) : error C2059: syntax error : '('
D:\work\bot\Src\Crypto.cpp(470) : error C2485: 'align' : unrecognized extended attribute
D:\work\bot\Src\Crypto.cpp(470) : error C2059: syntax error :

vc是没有align这种对齐用法的,只有intel c++ compile 才能编译通过.
用#pragma pack(n)基本是一样的,而且是微软的东西

注意,你不能自己定义 _linux 或 _win32 宏,否则可能出现你上面的错误。这个错误表明目前使用的系统不支持align属性。

关于预处理这一块并没有一个统一的标准,对同一问题编译器可能采取不同的处理方式。因此,对于你的这一问题,即如何设置内存对齐方式,应该查找你使用的编译器的文档。

您好,我现在也出现了你上面的完全一样的错误提示,请问您是怎么解决的啊,能不能指点我一下??O(∩_∩)O谢谢您了哦。我用的是VC6.0