This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
system calls in gcc-2.96 under RedHat Linux 7.0
- To: gcc-bugs at gcc dot gnu dot org, bug-gcc at gnu dot org
- Subject: system calls in gcc-2.96 under RedHat Linux 7.0
- From: Dirk Petry <petry at iastate dot edu>
- Date: Fri, 19 Jan 2001 12:43:13 -0600
Hi!
I have an awkward problem with gcc-2.96 under RedHat 7.0
when trying to compile C code containing the system calls
"read", "write" and "close" to be linked to a C++ main
programm:
My compile statement within the Makefile is
g++ -c -pipe -O2 -o serial.o serial.c
It results in the error message
serial.c: In function `int testserial (int, int, char *)':
serial.c:63: `close' undeclared (first use this function)
serial.c:63: (Each undeclared identifier is reported only once for each
function it appears in.)
serial.c:87: `write' undeclared (first use this function)
serial.c:102: `read' undeclared (first use this function)
make: *** [serial.o] Error 1
The interesting thing is that if I try to compile
exactly the same software with egcs 1.1.2 under
RedHat 6.1, it only gives warnings
serial.c: In function `int testserial(int, int, char *)':
serial.c:62: warning: implicit declaration of function `int close(...)'
serial.c:86: warning: implicit declaration of function `int write(...)'
serial.c:101: warning: implicit declaration of function `int read(...)'
but then links without problems. The program then runs flawlessly.
And even more interesting: If I compile under RedHat 7.0 using "gcc"
instead of "g++", the program compiles, but it doesn't link
with the rest of the program:
vdcmon.o: In function `sercom::~sercom(void)':
vdcmon.o(.text+0x3995): undefined reference to `terminate_serial(int *)'
...
and similar error messages from ld.
Can anybody tell me where to look for a solution to
this problem? Is it a bug or a feature?
Thanks in advance!
Dirk
--
----------------------------------------------
Dr. Dirk Petry, Dept. of Physics and Astronomy
Iowa State University, Ames, IA 50011
mailto:petry@iastate.edu phone:+1-515-294-3873