<div dir="ltr">Hi,<div><br></div><div>It is normal behaviour for installed headers intended for third-party development to expect to have their path prepended by the preprocessor, e.g.</div><div><br></div><div><font face="monospace">gcc -I/usr/local/gromacs/include yourfile.c -L/usr/local/gromacs/lib/whatever -lgromacs</font></div><div><br></div><div>This means that the same header file can be used the same way when compiling libgromacs, so one gets some sanity for free. Otherwise, we&#39;d also have to run some kind of script at &quot;make install&quot; time that copied the files and edited them, similar to what you have done with sed. Also, you&#39;ll have a harder time testing your code against multiple versions of GROMACS if you&#39;ve hard-coded the path to the include files, perhaps in many places, directly in your code - the -I option is very much your friend.</div><div><br></div><div>Do also be aware that libxdrfile is a thing.</div><div><br></div><div>Mark</div></div><br><div class="gmail_quote"><div dir="ltr">On Wed, Jul 6, 2016 at 4:53 PM Vladislav Martin &lt;<a href="mailto:martin.vl@husky.neu.edu">martin.vl@husky.neu.edu</a>&gt; wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div><div><div><div>Dear GROMACS developers,<br><br></div>I am writing code in C utilizing the GROMACS 5.1.2 library. The purpose of the code is to read the binary data stored in GROMACS&#39; XTC trajectory files into C data types for further analysis / manipulation of the data.<br><br></div><div>*NOTE*: In case this would be important information, I followed the <a href="http://manual.gromacs.org/documentation/5.1.2/install-guide/index.html#quick-and-dirty-installation" target="_blank">&quot;Quick and Dirty Installation&quot;</a> instructions for GROMACS 5.1.2 and all commands were executed in the terminal successfully.<br></div><div><br>Back to the C code. At the very top of my file, I include &quot;/usr/local/gromacs/include/gromacs/fileio/xtcio.h&quot; so that I may access the functions I need to read the XTC trajectory files. I ran into an odd error when attempting to compile my program. <br></div><br>&quot;&quot;<br>$ gcc -o read_trajectory read_trajectory.c -L /usr/local/gromacs/lib/x86_64-linux-gnu/ -lgromacs<br>In file included from read_trajectory.c:3:0:<br>/usr/local/gromacs/include/gromacs/fileio/xtcio.h:41:35: fatal error: gromacs/fileio/gmxfio.h: No such file or directory<br> #include &quot;gromacs/fileio/gmxfio.h&quot;<br>                                   ^<br>compilation terminated.<br>&quot;&quot;<br><br></div>I can fix this error by running a bash command that searches recursively through all header files in the &quot;usr/local/gromacs/include/gromacs&quot; directory and replaces &#39;gromacs/&#39; (which only shows up in #include statements) with &#39;/usr/local/gromacs/include/gromacs/&#39; (or &#39;/path/to/your/installation/gromacs/include/gromacs/&#39;). I have included this bash command in case someone else experiences this compilation error and wants to fix it quickly:<br><br>&#39;&quot;&quot;<br></div>$ sudo find /usr/local/gromacs/include/gromacs/ -name &#39;*.h&#39; -type f -exec sed -i &#39;s:gromacs/:/usr/local/gromacs/include/gromacs/:&#39; {} \;<br><div>&quot;&quot;<br><br></div><div>Once I run this command, the program compiles successfully and I am able to run the resulting executable without any further errors.<br></div><div><br>What confuses me is that this error could have been fixed when the GROMACS header files were created in the first place - I shouldn&#39;t have to fix the relative paths where the header files are supposed to look for &amp; find the other GROMACS header files. From what I can tell (I read the <a href="http://manual.gromacs.org/documentation/5.1.2/dev-manual/includestyle.html" target="_blank">#include directives</a>), every header file is contained within the &quot;/usr/local/gromacs/include/gromacs/&quot; directory (or, more generally, &quot;/path/to/your/installation/gromacs/include/gromacs/&quot;). Within that directory there are modular directories that store related headers, like &quot;fileio/&quot;. Knowing all of this, why does an #include statement referring to a GROMACS header file in that <u>same</u> directory say &quot;gromacs/fileio/gmxfio.h&quot; - which, as a relative path, would <u>never</u> point to the right directory - instead of &quot;gmxfio.h&quot; or &quot;./gmxfio.h&quot;, which actually reflects this file hierarchy?<br><br></div><div>In the end, my question is simple: did I miss something in the documentation that informs me on how to include GROMACS headers files properly so that I don&#39;t have to change the include statements myself? Otherwise, is this a syntax bug that will be fixed in later GROMACS versions?<br><br><br></div><div>Many thanks,<br><br></div><div>Vladislav Martin<br>Research Assistant<span style="font-weight:normal"></span><br>Center for Nanobiology and Structural Biology<br></div><div>Email: <a href="mailto:martin.vl@husky.neu.edu" target="_blank">martin.vl@husky.neu.edu</a><br></div></div>
--<br>
Gromacs Developers mailing list<br>
<br>
* Please search the archive at <a href="http://www.gromacs.org/Support/Mailing_Lists/GMX-developers_List" rel="noreferrer" target="_blank">http://www.gromacs.org/Support/Mailing_Lists/GMX-developers_List</a> before posting!<br>
<br>
* Can&#39;t post? Read <a href="http://www.gromacs.org/Support/Mailing_Lists" rel="noreferrer" target="_blank">http://www.gromacs.org/Support/Mailing_Lists</a><br>
<br>
* For (un)subscribe requests visit<br>
<a href="https://maillist.sys.kth.se/mailman/listinfo/gromacs.org_gmx-developers" rel="noreferrer" target="_blank">https://maillist.sys.kth.se/mailman/listinfo/gromacs.org_gmx-developers</a> or send a mail to <a href="mailto:gmx-developers-request@gromacs.org" target="_blank">gmx-developers-request@gromacs.org</a>.</blockquote></div>