织梦CMS - 轻松建站从此开始!

罗索

解决zlib编译不过

落鹤生 发布于 2013-11-18 22:33 点击:次 
zlib是个很牛的东东,从http://www.zlib.net/可 以获取到源码,但在VS2008下编译会报错:error PRJ0019: 某个工具从以下位置返回了错误代码: "Assembling...", 翻开BuildLog.htm查看其编译命令行ml.exe /nologo /c /coff /Cx /Zi /Fo".\Win32_DLL_ASM_Debug\inffas32.obj"
TAG:

zlib是个很牛的东东,从http://www.zlib.net/可 以获取到源码,但在VS2008下编译会报错:error PRJ0019: 某个工具从以下位置返回了错误代码: "Assembling...", 翻开BuildLog.htm查看其编译命令行ml.exe /nologo /c /coff /Cx /Zi /Fo".\Win32_DLL_ASM_Debug\inffas32.obj" "前面是我的路径\zlib123\contrib\masmx86\inffas32.asm", 然后将该命令放在"VS2008命令行提示"控制台下运行,报错的具体情况就很明显啦:

E:提示符>ml.exe /nologo /c /coff /Cx/Zi /Fo".\Win32_DLL_ASM_Debug\inffas32.obj" "我的路径\zlib123\contrib\masmx86\inffas32.asm"
 Assembling: E:\开源项目\压缩\zlib 1.2.3\zlib123\contrib\masmx86\inffas32.asm
我的路径\zlib123\contrib\masmx86\inffas32.asm(647) : error A2070:invalid instruction operands
我的路径\zlib123\contrib\masmx86\inffas32.asm(649) : error A2070:invalid instruction operands
我的路径\zlib123\contrib\masmx86\inffas32.asm(663) : error A2070:invalid instruction operands
我的路径\zlib123\contrib\masmx86\inffas32.asm(720) : error A2070:invalid instruction operands

 查下MSDN:

ML Nonfatal Error A2070

invalid instruction operands

One or more operands were not valid for the instruction with which they were specified.

(这个解释基本属于废话)

        上网一查,发现别人也遇到相同的问题: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]

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

 

参考:http://www.cppblog.com/tx7do/archive/2007/10/12/34014.aspx


2012-7-21

    在以静态库方式使用zlib-1.2.6时,发现LNK2019报错:
error LNK2019: 无法解析的外部符号 _deflateEnd
error LNK2019: 无法解析的外部符号 _deflate
error LNK2019: 无法解析的外部符号 _deflateInit_
error LNK2019: 无法解析的外部符号 _inflateEnd
error LNK2019: 无法解析的外部符号 _inflate
error LNK2019: 无法解析的外部符号 _inflateInit_
 
    经查需要在使用时定义ZLIB_WINAPI宏:
#ifdef _WIN32
    #define ZLIB_WINAPI
#endif
#include "zlib.h"

(dearymz)
本站文章除注明转载外,均为本站原创或编译欢迎任何形式的转载,但请务必注明出处,尊重他人劳动,同学习共成长。转载请注明:文章转载自:罗索实验室 [http://www.rosoo.net/a/201311/16822.html]
本文出处:网易博客 作者:dearymz 原文
顶一下
(0)
0%
踩一下
(0)
0%
------分隔线----------------------------
相关文章
发表评论
请自觉遵守互联网相关的政策法规,严禁发布色情、暴力、反动的言论。
评价:
表情:
用户名: 验证码:点击我更换图片
栏目列表
将本文分享到微信
织梦二维码生成器
推荐内容