[gmx-users] RE: gmx-users Digest, Vol 85, Issue 53
Ryan S Davis (rsdavis1)
rsdavis1 at memphis.edu
Mon May 9 01:10:22 CEST 2011
I am not sure if I replied to this thread correctly, but anyway.
I tried the things you guys suggested, but I still cant get it to work.
You were right $HOME does have a slash in front but I am not actually using that variable, just used it in the mailing list for convience, sorry.
I reinstalled the libraries, just to make sure everything went well.
So, here is what happens when I list out the library tree from my home directory and try to run the test code
$ ls -R /home/rsdavis1/apps/xdrfile/
/home/rsdavis1/apps/xdrfile/:
bin include lib
/home/rsdavis1/apps/xdrfile/bin:
trr2xtc
/home/rsdavis1/apps/xdrfile/include:
xdrfile
/home/rsdavis1/apps/xdrfile/include/xdrfile:
xdrfile.h xdrfile_trr.h xdrfile_xtc.h
/home/rsdavis1/apps/xdrfile/lib:
libxdrfile.a libxdrfile.la
$
$
$ icpc -I/home/rsdavis1/apps/xdrfile/include/xdrfile/ -L/home/rsdavis1/apps/xdrfile/lib/ test.cpp -lxdrfile
/tmp/icpcUuD5jZ.o: In function `main':
test.cpp:(.text+0x33): undefined reference to `read_xtc_natoms(char*, int*)'
$
and, again, test.cpp is just
1 #include "xdrfile_xtc.h"
2
3 int main()
4 {
5
6 int natoms;
7 read_xtc_natoms("traj.xtc",&natoms);
8 return 0;
9
10 }
The compiler is finding the ".h" file from the include because when I specify the wrong function arguments, it complains about it.
But, I guess it still isnt seeing the library.
Also, I tried compiling after appending the LIBDIR to my LD_LIBRARY_PATH and LD_RUN_PATH, neither worked.
Message: 1
Date: Fri, 6 May 2011 22:31:23 -0500
From: "Ryan S Davis (rsdavis1)" <rsdavis1 at memphis.edu>
Subject: [gmx-users] Using the XTC library
To: "gmx-users at gromacs.org" <gmx-users at gromacs.org>
Message-ID:
<6A7C9BBA12F23B478D0E40C0F6B8D4E87FCD231479 at itexbe11.uom.memphis.edu>
Content-Type: text/plain; charset="us-ascii"
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
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.
Thanks
Ryan
------------------------------
Message: 2
Date: Sat, 07 May 2011 13:55:26 +1000
From: Mark Abraham <Mark.Abraham at anu.edu.au>
Subject: Re: [gmx-users] Using the XTC library
To: Discussion list for GROMACS users <gmx-users at gromacs.org>
Message-ID: <4DC4C2AE.6090505 at anu.edu.au>
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
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
Message: 4
Date: Fri, 06 May 2011 22:22:04 -0700
From: "Joshua L. Phillips" <jphillips7 at ucmerced.edu>
Subject: Re: [gmx-users] Using the XTC library
To: gmx-users at gromacs.org
Message-ID: <1304745725.16113.32.camel at onesiphorus.mercedcapoeira.com>
Content-Type: text/plain; charset="UTF-8"
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