1

I have been working through the HeadFirstC book, one of the projects is using the "UNISTD.H" library. I know that this is not on my PC as it is a Unix/Linux library or something. I have done some research and looked at previous posts and cannot find a post that meets my needs to get this installed or a workaround.

I am using VSCode on a windows 10 64bit pc. Can anyone offer any help?

  • 3
    MSYS2 seems to ship `unistd.h`. [Here's how you install it](https://stackoverflow.com/q/30069830/2752075). – HolyBlackCat May 10 '22 at 07:37
  • @HolyBlackCat After installing and running the "Pacman -Syu" command, i get errors and my anti-virus software blocks the program. I will need to run this through IT support so they can try and fix it for me. –  May 10 '22 at 08:08
  • 1
    Why exactly do you need it? If it's just for some isolated example using some *nix function you could just run that one in an online compiler. https://godbolt.org/ runs on Linux x86_64. – Lundin May 10 '22 at 08:20
  • Yes atm i just need it for a small program, but i may also need something similar in the future so downloading something that would work on my PC is the best option. I have attempted using the reference you sent, But honestly i do not understand what is going on haha –  May 10 '22 at 08:26
  • Some compilers expect library headers to be enclosed in `<>`, so `#include `. The include search path can be different depending on the quote type. – Dave Meehan May 10 '22 at 08:41
  • Yeah my code works and compiles fine, its just the library itself. –  May 10 '22 at 08:48
  • Basically beginners should not need to worry about *nix-specific functions, or Windows-specific functions for that matter. I would suspect something like the `read` or `open` functions being used, which is something you don't need to study at all. – Lundin May 10 '22 at 09:09
  • 1
    I am working through the HeadFirstC book, i don't know 100% if it will be mentioned again, but i would like to work through it as i can experience different scenarios such as this one now. Having problems when coding and fixing them will stick in my head. –  May 10 '22 at 09:14

0 Answers0