ftruncate was not declared in this scope

I am make a program for a raspberry pi running Arch Linux. I need to set the size of a shared memory file. So I use ftruncate. But when I compile it, I get 'ftruncate’ was not declared in this scope. I have included unistd.h. I know its something stupid, I just can't figure it out. In case it matters, I am using the g++ compiler.
I don't have mine to hand, but ftruncate should be declared in unistd.h.

As it appears to not be there, just search for it:
grep -rl ftruncate /usr/include
I just tried that and it is there, then I realized that the error was coming from a library that I made, that I didn't realize it was compiling. Yup, I'm an idiot. Thanks for your assistance.
Topic archived. No new replies allowed.