Article View: gnu.gcc.bug
Article #6179a strchr() problem
From: Sven Hader
Date: Fri, 22 Nov 1996 00:00
Date: Fri, 22 Nov 1996 00:00
34 lines
1326 bytes
1326 bytes
Hi,
my name is Sven Hader from the Technical University of Chemnitz in Germany.
Developing a larger C++ application (using Linux v2.0.12, GNU CC v2.7.2 and
ld cynus-2.6) I encountered the following problem:
test program 'test.cc':
#include <string.h>
main()
{
char *c = strchr("hello",'e');
}
(1) Compiling this program using 'gcc test.cc' produced the linker error
message
'undefined reference to strchr(char *, int)' .
(2) Compiling this program using 'gcc -O2 test.cc' worked without problems.
(3) Renaming the program to 'test.c' and compiling using 'gcc test.c' worked
as well.
So my problem is: Why doesn't case (1) work while the others do ?
I would be very grateful to you for answering the above question or giving me
the name/adress of someone who could.
Bye. Sven
Technical Details
Message-ID:
<199611220912.KAA01119@moon>Path:
arc1-ca.pugleaf.net!unknown!not-for-mailShow Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 113d02,ef43a19454a6e850,start X-Google-Attributes: gid113d02,public From: Sven.Hader@Informatik.TU-Chemnitz.DE (Sven Hader) Subject: a strchr() problem Date: 1996/11/22 Message-ID: <199611220912.KAA01119@moon> X-Deja-AN: 198053118 sender: bug-gcc-request@prep.ai.mit.edu x-sun-charset: US-ASCII x-gateway: relay4.UU.NET from bug-gcc to gnu.gcc.bug; Fri, 22 Nov 1996 06:56:56 EST newsgroups: gnu.gcc.bug