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 Magnussen" <tim at timsplace dot dk>
- Date: Mon, 15 Oct 2001 11:08:55 +0200
- Reply-To: <tim at timsplace dot dk>
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 why this happens?
/Tim
test.c:23: implicit declaration of function `int ftruncate(...)'