[gmx-users] Using the XTC library

Mark Abraham Mark.Abraham at anu.edu.au
Sat May 7 05:55:26 CEST 2011


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



More information about the gromacs.org_gmx-users mailing list