[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

g++ / ld / publib linking problem



No-one has attempted an answer to this yet; if you have any ideas,
please let me know!

------- Repeated Message

Date:    Fri, 04 Jul 1997 22:21:39 +0100
From:    "Oliver Elphick" <olly@lfix.co.uk>
To:      debian-user@lists.debian.org
Subject: Problem linking with publib library and g++

I have a linking problem when I try to include functions from the
publib library in a C++ program.  This worked before I upgraded
to the new releases (see below).

An easy example:
 #include <publib.h>
 main()
 {
  char *x = "This   is  a string     with   spaces     ";
  char y[256];

  strcpy(y, x);
  strtrim(y);
  strmtrim(y);
  printf ("%s-\n%s-\n", x, y);
 }

When I try to compile this as C++:
 linda:~/cprogs$ g++ main.c -lpub        
 /tmp/cca132571.o: In function `main':
 /tmp/cca132571.o(.text+0x2b): undefined reference to `strtrim(char *)'
 /tmp/cca132571.o(.text+0x3a): undefined reference to `strmtrim(char *)'

but as C, it's fine:
 linda:~/cprogs$ gcc main.c -lpub
 linda:~/cprogs$ 

I can't work out what has changed and why this no longer works.

System:     Pentium Pro
Kernel:     2.0.30
Debian:     1.3 from unstable
gcc:        2.7.2.2-4
binutils:   2.8.1-1
publib-dev: 0.26-1
libc6:      2.0.3-4

------- End of Repeated Message

Even if I include the library directly on the command line, it doesn't
work:

linda:~/cprogs$ g++ main.c /usr/lib/libpub.a
/tmp/cca122331.o: In function `main':
/tmp/cca122331.o(.text+0x2b): undefined reference to `strtrim(char *)'
/tmp/cca122331.o(.text+0x3a): undefined reference to `strmtrim(char *)'

but again, gcc finds it:

linda:~/cprogs$ gcc main.c /usr/lib/libpub.a
linda:~/cprogs$ 

so it must be something different about the ways that gcc and g++ expect
to find things in libraries???

Since the original message, I have tried loading the source of publib
and recompiling it; this made no difference (there was no reason why
it should, but I'm clutching at straws now...)

-- 
Oliver Elphick                                Oliver.Elphick@lfix.co.uk
Isle of Wight                                  http://lfix.co.uk/oliver

     Make it idiot-proof, and someone will breed a better idiot.



--
TO UNSUBSCRIBE FROM THIS MAILING LIST: e-mail the word "unsubscribe" to
debian-user-request@lists.debian.org . 
Trouble?  e-mail to templin@bucknell.edu .


Reply to: