Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 4 Mar 1996 17:08:47 -0500 (EST)
From:      Chuck Robey <chuckr@Glue.umd.edu>
To:        "Eric L. Hernes" <erich@lodgenet.com>
Cc:        hackers@freebsd.org
Subject:   Re: C++ and wierd symbols
Message-ID:  <Pine.OSF.3.91.960304170136.13889A-100000@skipper.eng.umd.edu>
In-Reply-To: <199603041812.MAA09741@jake.lodgenet.com>

next in thread | previous in thread | raw e-mail | index | archive | help
On Mon, 4 Mar 1996, Eric L. Hernes wrote:

> 
> howdy,
> 
> I'm trying to compile some c++ stuff and I'm getting wierd
> link errors, like c++ is trying to overload some functions.
> does anyone have a clue as what's wrong?
> 
> here's the source that makes the call:
> 
> from `editor.c'
> ...
>       picture = pnm_readpnm(in_pipe,&cols,&rows,&maxval,&format);
>       if(picture==NULL)
> ...
> 
> the reference to pnm_readpnm() somehow gets translated into
> _pnm_readpnm__FP7__sFILEPiT1PUsT1(),  'cause the link line
> reports:
> editor.o: Undefined symbol `_pnm_readpnm__FP7__sFILEPiT1PUsT1' referenced from 
> text segment
> editor.o: Undefined symbol `_pnm_promoteformat__FPP5pixeliiUsiUsi' referenced 

Eric, in C++ the function call some_func(int) is completely different 
than the call some_func(double) or some_func(char).  The string of types 
being returned, and the class of the function, are encoded in the name 
that you see from the linker, and you have to be able to convert.  There 
are two ways to do this.  You can get the Annotated C++ Reference Manual 
(often called the ARM) and look up the rules in there.  A second way, if 
you're using the gcc compiler, is to use a tool called c++filt.  You just 
pipe any listing you have with those funny characters into it, and out 
spits fully qualified function names.  Great for debugging.

For gcc 2.6.3, you have to get the gnu binutils, its one of the utilities 
that get built.  If you try that, about half of the binutils won't build, 
and that's perfectly all right, because c++filt will build.  
Alternatively, mail me and I'll send you the binary;  WARNING, my binary 
was built using current, and wants the 2.2 libc.

> from text segment
> editor.o: Undefined symbol `_pnm_promoteformat__FPP5pixeliiUsiUsi' referenced 
> from text segment
> editor.o: Undefined symbol `_pnm_promoteformat__FPP5pixeliiUsiUsi' referenced 
> from text segment
> editor.o: Undefined symbol `_pm_freearray__FPPci' referenced from text segment
> editor.o: Undefined symbol `_pm_allocarray__Fiii' referenced from text segment
> editor.o: Undefined symbol `_ppm_writeppm__FP7__sFILEPP5pixeliiUsi' referenced 
> from text segment
> editor.o: Undefined symbol `_pm_freearray__FPPci' referenced from text segment
> *** Error code 1
> 
> 
> help.
> 
> eric.
> 
> --
> erich@lodgenet.com
> erich@rrnet.com
> 
> 

==========================================================================
Chuck Robey chuckr@eng.umd.edu, I run FreeBSD-current on n3lxx + Journey2
 
Three Accounts for the Super-users in the sky,
  Seven for the Operators in their halls of fame,
Nine for Ordinary Users doomed to crie,
  One for the Illegal Cracker with his evil game
In the Domains of Internet where the data lie.
  One Account to rule them all, One Account to watch them,
  One Account to make them all and in the network bind them.





Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?Pine.OSF.3.91.960304170136.13889A-100000>