-1

This is such a silly question, but i'm a beginner programmer, and I was following along a youtube tutorial on how to make a digital clock in the C language, and before the main() function there was #include<windows.h>. My computer had an error and after looking it up, I found out that is a file specific to windows? I saw some others said there are ways to "replace" the file or something, but i'm not really sure what to do. Anything helps. Thanks for your time.

  • 4
    A program that uses `windows.h` uses Windows-specific functions. You would have to figure out what the MacOS equivalents of the functions it's using are. It would be better to redesign the program so it uses a portable graphics library like Gtk. – Barmar Sep 08 '22 at 04:49
  • 2
    That tutorial is no good for beginner programmers. – n. m. could be an AI Sep 08 '22 at 04:53
  • 1
    If you tell us what tutorial you are following, we might give you some clues. But anyway, that tutorial seems to be for Windows, not for Mac, so that tutorial is not what you need at all. You probably should forget it alltogether. – Jabberwocky Sep 08 '22 at 07:30
  • @Jabberwocky, it was a tutorial for a digital clock. Here's the linkhttps://youtu.be/72fIizW3N-8 – masterbaiter6 Sep 09 '22 at 18:31
  • These kind of "tutorials" without any explanation are absolutely worthless. Find some proper book to learn C. That being said, in the tutorial they make a console program, just drop `#include ` and find some replacement for the [`Sleep`](https://learn.microsoft.com/en-us/windows/win32/api/synchapi/nf-synchapi-sleep) for the Mac. I can't REALLY help you with that. Maybe this helps: https://stackoverflow.com/questions/1157209/is-there-an-alternative-sleep-function-in-c-to-milliseconds – Jabberwocky Sep 10 '22 at 06:37

1 Answers1

0

Windows and macOS have very different interfaces. Apples uses a generic tool for all its platforms, thus there's no exact equivalent for windows.h in macOS. The closest equivalent I could find was Cocoa. (I'm not an Apple developer, I work mostly on Windows and Linux)

Use the official documentation as a starting point for developing apps on a specific or generic Apple platform. As it is a widely used platform, I expect you will find support on most issues you will encounter given your experience level, on the apple forum.

Also I found this nice tutorial that gives a basic introduction on Apple API's.

andrew
  • 1
  • 3