shm_open() undefined reference?

Hi all,

This is probably more of an environment/toolchain thing than an exclusively BBB thing, but I thought I’d ask here since my Google-foo has come up short with anything that has solved my problem.

I’m running the arm-linux-gnueabihf-4.8 compiler under Lubunutu and using Eclipse Luna as my IDE. I’ll be doing a project where I need to share memory between a number of processes and was hoping to use the POSIX shm_open() functionality to do this (though I guess a fallback could be plain old mmap’ing regular files). However, I’m unable to get even a one line program to compile because it constantly says shm_open() is an undefined reference. I see this both during compile and Eclipse even complains about it as I type it.

I believe I have all the pre-requisite includes in there:

#include <fcntl.h>
#include <sys/stat.h>
#include <sys/mman.h>
#include <unistd.h> <= for ftruncate() to resize the shared memory

What’s odd is that if I just type:

fd = shm_open();

and then hover over it, the “tooltips” correctly show me what the valid arguments are for that, but the minute I start typing in the function parameters it starts complaining about an undefined reference in the IDE - like the reference vanishes. This carries over to the compile.

I saw reference to using the -lrt flag but adding that to the flags under Miscellaneous in either gcc or the linker doesn’t help. CTRL-clicking on the function does dump me into mman.h where the function is prototyped, but it’s extern so I’m assuming it’s actually defined in the actual library - could it not actually be there? If anyone has any ideas that would be great.

Sorry if this is pedestrian, it’s my first foray into linux programming of any kind (having mainly done to-the-metal AVR programming and VHDL for FPGAs), so between the toolchains and all the libraries I’m a bit confused, haha.