[gmx-users] How to compile C++ propgram with xdrfile library?
Jussi Lehtola
jussi.lehtola at helsinki.fi
Sun May 17 20:12:29 CEST 2009
On Sun, 2009-05-17 at 10:56 -0700, Semen Esilevsky wrote:
> Ok, I have found the bug.
> In file xdrfile_xtc.h conditional directives should be "#ifdef __cplusplus", not "#ifdef CPLUSPLUS" !
<clip>
> After that I have functional text program.
> Now, I tried to make a test with C++ with this simplest program:
>
>
> #include "xdrfile.h"
> #include "xdrfile_xtc.h"
> int main(){
> XDRFILE* xd = xdrfile_open("a.xtc","r");
> int n;
> read_xtc_natoms("a.xtc",&n);
> }
That, or you can just use
extern C {
#include "xdrfile.h"
#include "xdrfile_xtc.h"
}
int main()
and so on
The same thing also works for gromacs header files.
--
------------------------------------------------------
Jussi Lehtola, FM, Tohtorikoulutettava
Fysiikan laitos, Helsingin Yliopisto
jussi.lehtola at helsinki.fi, p. 191 50632
------------------------------------------------------
Mr. Jussi Lehtola, M. Sc., Doctoral Student
Department of Physics, University of Helsinki, Finland
jussi.lehtola at helsinki.fi
------------------------------------------------------
More information about the gromacs.org_gmx-users
mailing list