Click here to Skip to main content
15,881,139 members
Please Sign up or sign in to vote.
5.00/5 (1 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
Updated 3-Feb-13 0:27am
v2

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.
 
Share this answer
 
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.
 
Share this answer
 
Comments
Albert Holguin 4-Feb-13 13:01pm    
+5
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.
 
Share this answer
 

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



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900