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

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);
  strmtrim(y);
  strtrim(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 *)'

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
-- 
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.


Attachment: pgpPK05oCoNO5.pgp
Description: PGP signature


Reply to: