[gmx-users] Re: help needed for using xdr library

Vitaly V. Chaban vvchaban at gmail.com
Mon Aug 17 19:34:12 CEST 2009


1. It seems you also need to include xdrfile.h.
2. Are the library files located in the same directory with your
source files when you link?


> Recently I am trying to use the xdr library downloaded from gromacs org to
> read xtc files. However when I link my program with the library there is an
> error. When I ran the make test, all the tests were passed. Thus I think
> that the library should work just I don't know how to link the program. I
> tried to read the makefile in the library but it is very
> complicated and beyond my scope. My program is very simple:
> //source file of cm.cc
> #include"/home/kun/xdr/include/xdrfile/xdrfile_xtc.h"
> int main()
> {
>    char * fn="fdifal";
>    int n=1;
>    read_xtc_natoms(fn, &n);
>    return 0;
> }
> and I could compile it. When I use
> g++ cm.o /home/kun/xdr/lib/libxdrfile.a there is a link error:
> cm.o: In function `main':
> cm.cc:(.text+0x2d): undefined reference to `read_xtc_natoms(char*, int*)'
> collect2: ld returned 1 exit status
> Could anyone help me?

More information about the gromacs.org_gmx-users mailing list