Click here to Skip to main content
13,143,774 members (35,465 online)
Rate this:
Please Sign up or sign in to vote.
See more:
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

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.
Posted 3-Feb-13 0:24am
Updated 3-Feb-13 0:27am
Rate this: bad
Please Sign up or sign in to vote.

Solution 3

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:[^]

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.
Rate this: bad
Please Sign up or sign in to vote.

Solution 2

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.
Albert Holguin 4-Feb-13 13:01pm
Rate this: bad
Please Sign up or sign in to vote.

Solution 1

unistd.h defines constants and declares functions for POSIX-compatible operating systems such as Linux or Unix. See[^]
If your code actually uses functions or constants from unistd.h you need to replace them with Windows equivalents.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy |
Web03 | 2.8.170915.1 | Last Updated 14 Dec 2013
Copyright © CodeProject, 1999-2017
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100