关于libpng和unistd.h的问题 [英] Problems conserning libpng and unistd.h

查看:96
本文介绍了关于libpng和unistd.h的问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

安装libpng和zlib之后我还有一些问题。

当我编译项目时,我收到错误告诉我 unistd.h 无法找到。

After installing libpng and zlib I still have some issues.
When I compile my project I get an error telling me that unistd.h can't be located.

Error	1	fatal error C1083: Cannot open include file: 'unistd.h': No such file or directory	c:\lib\gnuwin32\include\zconf.h	289



所以我只是评论了这一行。这会对我的代码产生什么影响?什么是标题 unistd.h for?



哦顺便说一下,我安装了GnuWin32的libpng因为我在Windows上。 Thanx。


So I just commented that line. What effect will this have on my code? and What is the header unistd.h for?

Oh by the way,I installed libpng of GnuWin32 because I'm on Windows. Thanx.

推荐答案

我认为其他解决方案都缺少重点。我看到同样的错误试图用我从这里得到的预构建的zlib二进制文件构建libpng:

http://gnuwin32.sourceforge.net/downlinks/zlib-lib-zip.php [ ^ ]



我认为包含的二进制文件很好,但是zconf。 h文件来自Linux构建,因此包含对unistd.h的引用。如果您只是使用二进制文件,它们应该没问题,但是如果在Windows版本中包含zconf.h,则会出现错误。我刚刚注释掉了有问题的块,我的构建工作也很好。
I think the other solutions are missing the point. I'm seeing the same error trying to build libpng with the prebuilt zlib binaries I got from here:
http://gnuwin32.sourceforge.net/downlinks/zlib-lib-zip.php[^]

I think the binaries included are fine, but the zconf.h file is from the Linux build and so includes a reference to unistd.h. If you just use the binaries they should be fine, but if you include zconf.h in a Windows build then you get an error. I just commented out the offending block and my build worked fine as well.


如果你的构建环境没有找到unistd.h那么它可能没有正确设置。要构建从Linux / Unix移植的东西,我想在这种情况下包括libpng,你通常需要一个工作的MinGW(Windows上的Minimal GNU)环境。虽然该项目可能是使用Visual Studio从错误构建的,但是看起来不太可能(微软的Windows头文件没有unistd.h)。

如果你有磁盘空间我可以推荐获得CodeBlocks IDE的副本,它带有一个非常最新的MinGW GCC,在安装简单后在Windows 7上开箱即用根本不是一个糟糕的IDE。
If your build environment is not finding unistd.h then it's likely not set up correctly. To build stuff ported from Linux/Unix which I guess includes libpng in this case you usually need a working MinGW (Minimal GNU on Windows)environment. Although it's possible that the project is designed to build with Visual Studio from the error you're getting it looks unlikely ( Microsoft's Windows headers don't have a unistd.h ).
I can recommend getting a copy of CodeBlocks IDE if you've got the disk space, it comes with a very up to date MinGW GCC, works out of the box on Windows 7 after a simple install and is not a bad IDE at all.


unistd.h 为POSIX兼容的操作系统(如Linux)定义常量并声明函数Unix的。请参阅 http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/unistd.h.html [ ^ ]

如果您的代码实际使用了来自 unistd.h 的函数或常量,则需要将它们替换为Windows等效函数。
unistd.h defines constants and declares functions for POSIX-compatible operating systems such as Linux or Unix. See http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/unistd.h.html[^]
If your code actually uses functions or constants from unistd.h you need to replace them with Windows equivalents.


这篇关于关于libpng和unistd.h的问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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