You could post the build log here, that would tell us some more.
But there's (almost) nothing wrong with your code itself. I copied, pasted it, compiled and ran it. You probably configured your project wrongly (don't worry, there are LOT of options!)
In Xcode, choose New Project. Choose the macOS Command-line Tool template. Give the project a name, choose C as the language.
Once you save it, you'll get an Xcode project containing a command-line tool target which will print "hello, world" to stdout when run.
You can select all the code you posted here, paste it in to main.c (replacing everything in the template code). Xcode will flag some errors due to formatting which are easy to correct - for example each #include line needs to be on a separate line.
You'll end up with one warning about int main() being deprecated. You can fix that by changing
int main () {
to
int main (void) {
or
int main(int argc, char ** argv) {
after that, your program should build and run.
If it doesn't, read the detailed build log, and if you don't understand it, post it here.