windows下使用的MinGW的zlib [英] Using zlib under windows mingw

查看:1802
本文介绍了windows下使用的MinGW的zlib的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我似乎无法得到的zlib windows下做任何事情的MinGW

I can't seem to get zlib to do anything on mingw under windows.

我下载的zlib @ 的http:/ /sourceforge.net/projects/mingw/files_beta/MinGW/zlib/zlib-1.2.3-1-mingw32/ 并放在正确的地方头和lib文件。

I downloaded zlib @ http://sourceforge.net/projects/mingw/files_beta/MinGW/zlib/zlib-1.2.3-1-mingw32/ and put the header and lib files in the right place.

简单code,如:

#include <stdlib.h>
#include <stdio.h>

#include "zlib.h"

int main(int argc, char *argv[])
{
    long a;
    char buffer[1024];
    a = 1024;
    compress(buffer,&a,"testing",7);
    return 0;
}

编译:

gcc test.c -lzlib -Wall -o test.exe

编译罚款。
然而在COM preSS功能的EXE崩溃。
任何想法?

Compiles fine. However the exe crashes at the compress function. Any ideas?

推荐答案

我试图用从MSYS zlib的(使用MinGW-获得访问),并得到了同样的问题,如下所述。

I tried to use the zlib from MSYS (accessible with mingw-get) and got the same problem as described below.

解决的办法是做一个静态链接,而不是使用共享库。
只需删除或重命名导入库libz.dll.a避免连接器来与MSYS-z.dll的链接。

The solution is to do a static link instead of using the shared library. Just remove or rename the import library libz.dll.a to avoid the linker to do a link with the msys-z.dll.

重新编译,这将是工作。

Recompile and it will be working.

另一种方法是安装ZLIB自己免受来自zlib.net网站。
取下一个MinGW的-搞定。

Another way is to install zlib yourself from the zlib.net website. Remove the one from mingw-get.

这篇关于windows下使用的MinGW的zlib的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆