原文转自 http://dearymz.blog.163.com/blog/static/2056574200871010027435/

1、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


2、 在以静态库方式使用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"
 
 

最新文章

  1. ubuntu 14.04LTS 环境下配置NFS服务
  2. 在windows 10中使用pip安装psutil 4.3.0
  3. sql server 跨数据库插入数据
  4. javascript篇-----函数apply()和call()
  5. 资源监控工具--spotlight
  6. vbox下Oracle Enterprise liunx5.4虚拟机安装10G RAC实验(四)
  7. 【Longest Palindromic Substring】cpp
  8. mirantis fuel puppet执行顺序 和 对整个项目代码的执行流程理解
  9. [置顶] access函数-linux
  10. 雕爷牛腩这样判断零售未来-搜狐IT
  11. 使用Sublime Text 2编辑和运行node-webkit应用程序
  12. UAC权限
  13. cmd 更改计算机名
  14. Douglas Adams - 3 Rules That Describe Our Reactions To Technologies 科技影响生活的三个规律
  15. es6 this指向
  16. WIndows 使用VS编译 Lua5
  17. 『Python CoolBook』C扩展库_其六_线程
  18. 虚方法virtual、抽象方法abstract、接口interface区别
  19. STL中实现 iterator trail 的编程技巧
  20. Ubuntu 下 Sublime 无法输入中文?(已解决)

热门文章

  1. 1016-01-首页16-计算配图的frame----MJExtention的使用
  2. 云心出岫——Splay Tree
  3. Linux查看程序端口占用
  4. SLB 7层负载均衡“HUNG”问题追查
  5. 《Cracking the Coding Interview》——第4章:树和图——题目8
  6. 深入理解synchronize
  7. Vue打包app
  8. 网络--路由表&IP选路
  9. Struts2+DAO层实现实例02——搭建DAO基本框架并与Struts2组合
  10. Scala 基础(5)—— 构建函数式对象