🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

1 total messages Started by Sven Hader Fri, 22 Nov 1996 00:00
a strchr() problem
#6179
Author: Sven Hader
Date: Fri, 22 Nov 1996 00:00
34 lines
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
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads