[vtkusers] GCC "Name Mangling" Prevent from Linking VTK?

William A. Hoffman billlist at nycap.rr.com
Fri Apr 12 09:48:01 EDT 2002


Sounds like you are mixing two different compilers.
Looks like gcc 2.95 and gcc 3.0.4 name mangling.

-Bill


At 08:40 PM 4/12/2002 +0800, Chih-Wei Chiu wrote:
>This is a following post of:
>
>"Fail to link with static VTK 4 on Linux (but succeed on Windows)"
>
>I find a "potential problem." Uh...this may be "the problem," but would
>you convince me why this works?
>
>I doubted it's because the compiler performed different name mangling
>scheme to my program and VTK library, and that's why linker failed.
>
>To see why, run `nm' on dump the `symbol' used by
>vtkMarchingCubes::New()
>
>[ccbsd7]~>nm /usr/local/lib/vtk/libvtkPatented.a | grep MarchingCubes |
>grep New
>        ....(omitted)...
>         U New__16vtkMarchingCubes
>         U New__21vtkImageMarchingCubes
>00000000 T New__16vtkMarchingCubes
>
>While my program gets:
>
>[ccbsd7]~>nm /tmp/isosurface.o |grep MarchingCubes
>         U _ZN16vtkMarchingCubes3NewEv
>00000000 W _ZN16vtkMarchingCubes8SetValueEif
>
>I guess the linker complained `undefined reference' because the function
>vtkMarchingCubes::New() is called New__16vtkMarchingCubes in VTK, while
>it's called _ZN16vtkMarchingCubes3NewEv in my program's object file.
>Why?
>
>
>
>VTK: 4.0
>Compiler: GCC 3.0.4
>OS: RedHat Linux 6.2 (same problem on FreeBSD too)
>compiler options: -g -O2
>
>--
>Chih-Wei Chiu <http://www.csie.nctu.edu.tw/~jwchiu>
>Computer Graphics and Geometry Modeling Laboratory,
>Computer Science and Information Engineering Department,
>National Chiao-Tung University, Taiwan
>_______________________________________________
>This is the private VTK discussion list. 
>Please keep messages on-topic. Check the FAQ at: <http://public.kitware.com/cgi-bin/vtkfaq>
>Follow this link to subscribe/unsubscribe:
>http://public.kitware.com/mailman/listinfo/vtkusers 




More information about the vtkusers mailing list