Hi,<br><br>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&#39;t know what&#39;s the problem because the make test command passed. <br>
<br><br><div class="gmail_quote">On Mon, Aug 17, 2009 at 1:34 PM, Vitaly V. Chaban <span dir="ltr">&lt;<a href="mailto:vvchaban@gmail.com">vvchaban@gmail.com</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
Hi,<br>
<br>
1. It seems you also need to include xdrfile.h.<br>
2. Are the library files located in the same directory with your<br>
source files when you link?<br>
<font color="#888888"><br>
VItaly<br>
</font><div><div></div><div class="h5"></div></div></blockquote><div><br> </div><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"><div><div class="h5">
<br>
&gt;<br>
&gt; Recently I am trying to use the xdr library downloaded from gromacs org to<br>
&gt; read xtc files. However when I link my program with the library there is an<br>
&gt; error. When I ran the make test, all the tests were passed. Thus I think<br>
&gt; that the library should work just I don&#39;t know how to link the program. I<br>
&gt; tried to read the makefile in the library but it is very<br>
&gt; complicated and beyond my scope. My program is very simple:<br>
&gt; //source file of cm.cc<br>
&gt; #include&quot;/home/kun/xdr/include/xdrfile/xdrfile_xtc.h&quot;<br>
&gt; int main()<br>
&gt; {<br>
&gt;    char * fn=&quot;fdifal&quot;;<br>
&gt;    int n=1;<br>
&gt;    read_xtc_natoms(fn, &amp;n);<br>
&gt;<br>
&gt;    return 0;<br>
&gt; }<br>
&gt; and I could compile it. When I use<br>
&gt; g++ cm.o /home/kun/xdr/lib/libxdrfile.a there is a link error:<br>
&gt; cm.o: In function `main&#39;:<br>
&gt; cm.cc:(.text+0x2d): undefined reference to `read_xtc_natoms(char*, int*)&#39;<br>
&gt; collect2: ld returned 1 exit status<br>
&gt; Could anyone help me?<br>
</div></div></blockquote></div><br>