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

Kun Huang harryhuangkun at gmail.com
Mon Aug 17 19:55:53 CEST 2009


Hi,

Actually the xdrfile_xtc.h file did include the xdrfile.h. And I also tried
to include xdrfile_xtc.h directly in my source file. The link error is still
there. I really don't know what's the problem because the make test command
passed.


On Mon, Aug 17, 2009 at 1:34 PM, Vitaly V. Chaban <vvchaban at gmail.com>wrote:

> Hi,
>
> 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?
>
> VItaly
>



>
> >
> > 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?
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://maillist.sys.kth.se/pipermail/gromacs.org_gmx-users/attachments/20090817/f99eb9a2/attachment.html>


More information about the gromacs.org_gmx-users mailing list