This is the mail archive of the gcc-help@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

POSIX features disappear with g++


Hi there. I'm writing a C++ application which needs to acces some shared
memory and I'm using the Posix functions for this. The code compiles fine
with gcc but when I'm using g++ it complaints that the function ftruncate
is not defined.

OS: Linux 2.4.2
g++ version: 2.95.3

The code (partly):
        shm_descr = shm_open(SHM_AREA_NAME, O_CREAT|O_RDWR, S_IRUSR);
        if (ftruncate(shm_descr, 42)<0)
                perror("ftruncate");

Running gcc (gcc -lrt test.c)
	Works like a charm.

Running g++ (g++ -lrt test.c)
	test.c: In function `int main(int, char **)':
	test.c:23: implicit declaration of function `int ftruncate(...)'

Does anyone have an idea what's going on?

/Tim


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]