[gmx-users] Using the XTC library
Joshua L. Phillips
jphillips7 at ucmerced.edu
Sat May 7 07:22:04 CEST 2011
You will need to link with the library as well (-lxdrfile)
Something like the following should work (if the paths that you provided
are correct):
icpc -I$HOME/apps/xdrfile/include/xdrfile \
-L$HOME/apps/xdrfile/lib test.cpp -o test -lxdrfile
(Since, this is C++ code, then you should be using icpc instead of
icc...)
-- Josh
On Sat, 2011-05-07 at 13:55 +1000, Mark Abraham wrote:
> On 7/05/2011 1:31 PM, Ryan S Davis (rsdavis1) wrote:
> > I am trying to use the XTC library in my code but I am just not good at this stuff.
> > http://www.gromacs.org/Developer_Zone/Programming_Guide/XTC_Library
> >
> >
> > I installed using
> > ./configure --prefix=/$HOME/apps/xdrfile
>
> This might not be the problem, but the HOME environment variable here
> and below will normally start with a slash, and so you should not
> preface it with another.
>
> > make install
> >
> > everything seemed to go well and the make check said everything passed.
> >
> > So then I try a test code
> >
> > 1 #include<iostream>
> > 2 #include "xdrfile_xtc.h"
> > 3 using namespace std;
> > 4
> > 5 int main()
> > 6 {
> > 7
> > 8 int natoms;
> > 9 read_xtc_natoms("traj.xtc",&natoms);
> > 10 return 0;
> > 11 }
> >
> > and I compile with
> >
> > icc -I/$HOME/apps/xdrfile/include/xdrfile -L/$HOME/apps/xdrfile/lib/ test.cpp
> >
> > and i get an error saying...
> >
> > undefined reference to 'read_xtc_natoms(char *, int*)'
> >
> > I am sure that I am doing something stupid. I tried a C compiler and linking to few other random places but, like I said, this stuff (installing libraries and linking) is new to me.
> > Please help.
>
> icc -I$HOME/apps/xdrfile/include/xdrfile test.cpp
>
> will find $HOME/apps/xdrfile/include/xdrfile/xdrfile_xtc.h
>
> Mark
--
Joshua L. Phillips
Ph.D. Candidate - School of Engineering
University of California, Merced
jphillips7 at ucmerced.edu
More information about the gromacs.org_gmx-users
mailing list