This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
POSIX features disappear with g++
- To: gcc-help at gcc dot gnu dot org
- Subject: POSIX features disappear with g++
- From: tim at timsplace dot dk
- Date: Mon, 15 Oct 2001 10:03:57 +0200 (CEST)
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