[gmx-developers] Gromacs in C++
Christian Mötzing
christian at moetzing.net
Tue Sep 21 23:17:54 CEST 2010
Am Dienstag, den 21.09.2010, 23:05 +0200 schrieb David van der Spoel:
> On 2010-09-21 22.27, Christian Mötzing wrote:
> > Hi,
> >
> > I tried to compile Gromacs in with g++ today and I had no success.
> >
> > I tried to find something in the archive, but the serach does not seem
> > to work correctly. If I search for C++ nothing turns up. If I search for
> > smalloc.h one of the first hits is "compiling with c++". Why can't this
> > be found via searching for C++?
> >
> > Now to the real problem. I used the tarball of 4.0.7. At first I got
> > some const char* error which are easy to fix. Next one is this:
> >
> > nonbonded.c: In function ‘void gmx_setup_kernels(FILE*)’:
> > nonbonded.c:194: error: invalid conversion from ‘void*’ to ‘void
> > (**)(int*, int*, int*, int*, int*, real*, real*, int*, real*, real*,
> > real*, real*, real*, real*, real*, int*, int*, real*, real*, real*,
> > real*, real*, real*, real*, real*, int*, int*, void*, int*, int*,
> > real*)’
> > nonbonded.c: At global scope:
> > nonbonded.c:808: error: expected ‘}’ at end of input
> > make[5]: *** [nonbonded.lo] Fehler 1
> >
> > As I understand the reason can be found in smalloc.h:
> >
> > #define snew(ptr,nelem) (ptr)=save_calloc(#ptr,__FILE__,__LINE__,\
> > (nelem),sizeof(*(ptr)))
> >
> > calloc returns void* and assigns it to ptr, no matter what type ptr is.
> > I think this can't be done without an explicit typecast.
> >
> > Does Gromacs even support compiling it with g++? I at least found some
> > #ifdef CPLUSPLUS to ensure C++ compatibility?
> >
> > All I did was to set CC to g++. Is this correct?
> >
> > Greetings
> >
> > Christian
> >
> We will transition the head branch to C++ soon. Right now 4.5.1 and the
> head branch compile in C++ already, but with many warnings. There are no
> plans to do this for 4.0.7.
>
> --
> David van der Spoel, Ph.D., Professor of Biology
> Dept. of Cell & Molec. Biol., Uppsala University.
> Box 596, 75124 Uppsala, Sweden. Phone: +46184714205.
> spoel at xray.bmc.uu.se http://folding.bmc.uu.se
Ok, then I will try the version from git. Thanks.
More information about the gromacs.org_gmx-developers
mailing list