陈硕的Blog

吾尝终日而思矣,不如须臾之所学也。吾尝跂而望矣,不如登高之博见也。……君子生非异也,善假于物也。

原创 zlib 在 Visual Studio 2005 下编译失败的解决办法收藏

最近需要读写 png 文件,按照以前的办法试验,却发现无法编译zlib 1.2.3。出错信息为:

inffas32.asm(594) : error A2070: invalid instruction operands
inffas32.asm(596) : error A2070: invalid instruction operands
inffas32.asm(610) : error A2070: invalid instruction operands
inffas32.asm(667) : error A2070: invalid instruction operands

上网一查,发现别人也遇到相同的问题:http://svn.haxx.se/dev/archive-2005-11/0942.shtml。原因在于

It (Microsoft Macro Assembler 8.0, included with Visual C++ 2005 Express ) refuses to assemble a MOVD instruction with a memory operand with an implied size, and requires that "dword ptr" prefix the memory operand.

微软说这是by design,不是bug:

http://lab.msdn.microsoft.com/productfeedback/viewfeedback.aspx?feedbackid=6306f7dc-2cc2-4591-bd60-5d802178fdfa

解决办法是把inffas32.asm中的4处出错的类似

 movd mm4, [esp+0]

的汇编代码,添加dword ptr修饰符,改为

 movd mm4,dword ptr [esp+0]

这样就能顺利编译、通过测试了。

发表于 @ 2006年02月06日 15:07:00|评论(loading...)

新一篇: CC2e:《代码大全(第2版)》集萃 | 旧一篇: 向Word和PowerPoint插入LaTeX公式的小工具

Csdn Blog version 3.1a
Copyright © 陈硕