From: John Stone (johns_at_ks.uiuc.edu)
Date: Fri May 29 2009 - 13:24:30 CDT

David,
  In the case below, you want to have the -lmolfile_plugin and -lm at
the end of the g++ link command, _after_ all of the object files.
You may also want to check that you're linking against the right
libmolfile_plugin.a (e.g. 32-bit vs. 64-bit, etc).

Cheers,
  John

On Fri, May 29, 2009 at 01:18:28PM -0500, David Tanner wrote:
> I had been using g++ but was getting similar errors also (shown below), so I
> gave gcc a whirl.
>
> gcc -I./inc -Ilib/lib_LINUX -Llib/lib_LINUX -m32 -Wall -o obj/main.o -c
> src/Main.C
> gcc -I./inc -Ilib/lib_LINUX -Llib/lib_LINUX -m32 -Wall -o obj/configio.o -c
> src/ConfigIO.C
> gcc -I./inc -Ilib/lib_LINUX -Llib/lib_LINUX -m32 -Wall -o obj/molfileapi.o
> -c src/MolfileAPI.C
> gcc -I./inc -Ilib/lib_LINUX -Llib/lib_LINUX -m32 -Wall -o obj/hash.o -c
> src/hash.c
> gcc -I./inc -Ilib/lib_LINUX -Llib/lib_LINUX -m32 -Wall -o obj/getplugins.o
> -c src/getplugins.c
> g++ -I./inc -Ilib/lib_LINUX -Llib/lib_LINUX -m32 -Wall -o bin/psapd
> -lmolfile_plugin -lm obj/main.o obj/configio.o obj/molfileapi.o obj/hash.o
> obj/getplugins.o
> obj/getplugins.o(.text+0x107): In function `init_plugins':
> : undefined reference to `molfile_biomoccaplugin_init'
> obj/getplugins.o(.text+0x10c): In function `init_plugins':
> : undefined reference to `molfile_cpmdplugin_init'
> obj/getplugins.o(.text+0x111): In function `init_plugins':
> : undefined reference to `molfile_psfplugin_init'
>
> Thank you,
> David E. Tanner
>
> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> David E. Tanner
> Theoretical and Computational Biophysics Group
> 3159 Beckman Institute
> University of Illinois at Urbana-Champaign
> 405 N. Mathews
> Urbana, IL 61801
> http://www.linkedin.com/in/davidetanner
> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>
>
>
>
>
> On Fri, May 29, 2009 at 1:07 PM, John Stone <johns_at_ks.uiuc.edu> wrote:
>
> >
> > David,
> > You need to link using "g++" and not "gcc", as several of the VMD
> > molfile plugins are written in C++. If that's not convenient, you could
> > try manually linking with -lstdc++, but I think doing the final link step
> > with "g++" will be far simpler for you.
> >
> > Cheers,
> > John
> >
> >
> > On Fri, May 29, 2009 at 01:02:59PM -0500, David Tanner wrote:
> > > I am trying to use molfile_plugin in a personal MD program.
> > > Below is my errored output from my make file.
> > > The first 5 compiles are individual object files.
> > > The 6th is compiling the binary file which, as I understand it, needs to
> > be
> > > linked to libmolfile_plugin.a, which I have located in lib/lib_LINUX
> > (along
> > > with all the shared libraries built with libmolfile_plugin.a).
> > > The init_plugins function of getplugins.c contains the pre-processor
> > command
> > > MOLFILE_INIT_ALL which brings up all the molfile_..._init.
> > > I don't understand what's wrong with my linking; all the appropriate
> > files
> > > contain "#include libmolfile_plugin.h", and I have tried to link to the
> > > static library libmolfile_plugin.a.
> > >
> > > gcc -I./inc -Ilib/lib_LINUX -Llib/lib_LINUX -m32 -Wall -o obj/main.o -c
> > > src/Main.C
> > > gcc -I./inc -Ilib/lib_LINUX -Llib/lib_LINUX -m32 -Wall -o obj/configio.o
> > -c
> > > src/ConfigIO.C
> > > gcc -I./inc -Ilib/lib_LINUX -Llib/lib_LINUX -m32 -Wall -o
> > obj/molfileapi.o
> > > -c src/MolfileAPI.C
> > > gcc -I./inc -Ilib/lib_LINUX -Llib/lib_LINUX -m32 -Wall -o obj/hash.o -c
> > > src/hash.c
> > > gcc -I./inc -Ilib/lib_LINUX -Llib/lib_LINUX -m32 -Wall -o
> > obj/getplugins.o
> > > -c src/getplugins.c
> > > gcc -I./inc -Ilib/lib_LINUX -Llib/lib_LINUX -m32 -Wall -o bin/psapd
> > > -lmolfile_plugin -lm obj/main.o obj/configio.o obj/molfileapi.o
> > obj/hash.o
> > > obj/getplugins.o
> > > obj/main.o(.eh_frame+0x11): undefined reference to `__gxx_personality_v0'
> > > obj/configio.o(.eh_frame+0x11): undefined reference to
> > > `__gxx_personality_v0'
> > > obj/getplugins.o(.text+0x107): In function `init_plugins':
> > > : undefined reference to `molfile_biomoccaplugin_init'
> > > obj/getplugins.o(.text+0x10c): In function `init_plugins':
> > > : undefined reference to `molfile_cpmdplugin_init'
> > > obj/getplugins.o(.text+0x111): In function `init_plugins':
> > > : undefined reference to `molfile_psfplugin_init'
> > > obj/getplugins.o(.text+0x116): In function `init_plugins':
> > > : undefined reference to `molfile_pdbplugin_init'
> > > ...
> > >
> > > Thank you,
> > > David E. Tanner
> > >
> > > ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> > > David E. Tanner
> > > Theoretical and Computational Biophysics Group
> > > 3159 Beckman Institute
> > > University of Illinois at Urbana-Champaign
> > > 405 N. Mathews
> > > Urbana, IL 61801
> > > http://www.linkedin.com/in/davidetanner
> > > ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> >
> > --
> > NIH Resource for Macromolecular Modeling and Bioinformatics
> > Beckman Institute for Advanced Science and Technology
> > University of Illinois, 405 N. Mathews Ave, Urbana, IL 61801
> > Email: johns_at_ks.uiuc.edu Phone: 217-244-3349
> > WWW: http://www.ks.uiuc.edu/~johns/ <http://www.ks.uiuc.edu/%7Ejohns/>
> > Fax: 217-244-6078
> >

-- 
NIH Resource for Macromolecular Modeling and Bioinformatics
Beckman Institute for Advanced Science and Technology
University of Illinois, 405 N. Mathews Ave, Urbana, IL 61801
Email: johns_at_ks.uiuc.edu                 Phone: 217-244-3349
  WWW: http://www.ks.uiuc.edu/~johns/      Fax: 217-244-6078