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 <vvcha...@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? >
_______________________________________________ gmx-users mailing list gmx-users@gromacs.org http://lists.gromacs.org/mailman/listinfo/gmx-users Please search the archive at http://www.gromacs.org/search before posting! Please don't post (un)subscribe requests to the list. Use the www interface or send it to gmx-users-requ...@gromacs.org. Can't post? Read http://www.gromacs.org/mailing_lists/users.php