Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: C++ C
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 1:24am
Edited 3-Feb-13 1:27am
v2
Rate this: bad
good
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:
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.
  Permalink  
Rate this: bad
good
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.
  Permalink  
Comments
Albert Holguin at 4-Feb-13 13:01pm
   
+5
Rate this: bad
good
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 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.
  Permalink  

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

  Print Answers RSS
0 DamithSL 305
1 OriginalGriff 295
2 Sergey Alexandrovich Kryukov 207
3 Peter Leow 175
4 Afzaal Ahmad Zeeshan 154
0 OriginalGriff 7,460
1 DamithSL 5,519
2 Sergey Alexandrovich Kryukov 4,954
3 Maciej Los 4,936
4 Kornfeld Eliyahu Peter 4,514


Advertise | Privacy | Mobile
Web02 | 2.8.141223.1 | Last Updated 14 Dec 2013
Copyright © CodeProject, 1999-2014
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