#include "<stdlib.h>" ERROR!


#1

With respect to the standard libraries, I’m getting an error on the line shown in the subject to this post. The error reads: file ‘<stdlib.h>’ not found

I wonder if the cause is that I don’t have all the developer tools? I downloaded XCode from the Mac App Store. According to the book, after installing XCode I should have a /Developer folder at the root level of my hard drive. I don’t have that.

I’ve looked on Apple’s web site trying to find additional developer files to download, but haven’t found anything. What did I miss?


#2

tap tap… is this thing on?
anybody? bueller?


#3

Get rid of the double-quotes.


#4

ahhhh… simple. Thanks for catching that for me.

I’m still curious, though, why I don’t have the Developer folder. Not needed any more?

thanks again…


#5

On my system (Latest Xcode, etc.) the sleep function is in unistd.h

I did a search of the man pages to find this. Apparently sleep() is not in std lib.


#6

[quote=“geo3rge”]On my system (Latest Xcode, etc.) the sleep function is in unistd.h

I did a search of the man pages to find this. Apparently sleep() is not in std lib.[/quote]

Thanks geo3rge, that did the job!


#7

Thanks for this tip.


#8

xxx


#9

I’m not sure how to do it in Xcode, but if you bring up a terminal window, here’s how I identified the right library:
[ol]
[li] man sleep[/li]
[li] See that this isn’t the right manual page, but at the bottom (use spacebar to page down if needed) you see the “SEE ALSO” section has sleep(3) listed as a related page[/li]
[li] Use q to quit[/li]
[li] man 3 sleep[/li]
[li] See #include <unistd.h> at the top of the “SYNOPSIS” section[/li][/ol]

The UNIX man command is an online help system that’s been in use for ~40 years now. It’s quite primitive but very, very useful.

On a tangent: one of the great ideas in the development of UNIX was including a “BUGS” section in man pages. The story goes that developers, when writing the documentation, would be too embarrassed to write down some of their bugs. Instead, they’d go back and fix the code.