码迷,mamicode.com
首页 > 其他好文 > 详细

zlib编译安装

时间:2015-12-22 22:47:13      阅读:175      评论:0      收藏:0      [点我收藏+]

标签:

http://www.zlib.net/下载了最新的源代码

zlib提供了vs sln文件,在zlib-1.2.8\contrib\vstudio\目录有

其中的zlibstat是编译为静态库
zlibvc是编译为动态库,还有其它一些工程暂时未研究

 

windows上编译倒是会成功。

有一个项目调用zlib,发生错误

zconf.h Cannot open include file: ‘unistd.h‘: No such file or directory

看了有些说明,说可以这么做:

If you‘re using ZLib in your project, then you need to find :

#if 1
in zconf.h and replace(uncomment) it with :

#if HAVE_UNISTD_H /* ...the rest of the line
If it isn‘t ZLib I guess you should find some alternative way to do this. GL.

参考:http://www.360doc.com/content/13/0124/17/1200324_262179628.shtml

 

vc 创建win32工程,在]win32下调用zlib库的函数compress编译错误(error LNK2019: 无法解析的外部符号 _compress?

答案:把zlib 1.2.5加入自己的项目,编译时有两点要注意
1.就是zlib 1.2.5源代码包中\contrib\vstudio\readme.txt中说的在使用zlib要预定义宏ZLIB_WINAPI,否则无法编译通过。
- To use zlibwapi.dll in your application, you must define the  macro ZLIB_WINAPI when compiling your application‘s source files.
2.链接时,除了#pragma comment(lib, "zlibvc.lib")添加引入库外,还要注意Character Set的设置要统一。否则也会出现链接错误,提示找不到_compress外部变量。 

我在工程属性->C++->预定义宏->预处理器定义 .增加ZLIB_WINAPI这个宏,然后link就好了就好了。

 http://blog.csdn.net/xiabodan/article/details/38391171?utm_source=tuicool&utm_medium=referral

http://blog.sina.com.cn/s/blog_96ea53fb0101ldd9.html

 

zlib编译安装

标签:

原文地址:http://www.cnblogs.com/youxin/p/5068358.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!