[MBDyn-users] Compiling MBDyn on Mac OS X (Intel)
masarati at aero.polimi.it
Tue Oct 28 20:27:56 CET 2008
Aaron Hoover wrote:
> I'm trying to compile MBDyn (1.3.4-Beta) from source on Leopard using
> gcc/g++ 4.4 and gfortran (download from http://hpc.sourceforge.net/).
> I'm getting pretty far in the make step, but I run into the following
> beam.cc:145: error: uninitialized member 'Beam::f' with 'const' type
> 'const Vec3 '
> beam.cc:145: error: uninitialized member 'Beam::RNode' with 'const' type
> 'const Mat3x3 '
> Has anyone here had any success with compiling for Leopard or even just
> Intel Mac? I noticed the post about compiling on PowerPC, but it didn't
> seem relevant to what I'm trying to do. Any help is much appreciated.
I haven't got so far in trying g++. Probably, it's way too strict than
what we use right now (personally:
bash-3.2$ g++ --version
g++ (GCC) 4.1.2 20071124 (Red Hat 4.1.2-42)
others might be using more recent versions; Marco?). The issue seems to
be related to using arrays of const classes. An array member needs to
be made of objects with an empty constructor, as array members need to
be initialized later in the object's constructor. Since the objects are
const, a const_cast is needed to initialize them. Probably this is a
bug in g++ 4.4, since Vec3 (and later on, Mat3x3) has an empty
constructor essentially to deal with this type of situations. However,
I should check C++ specs more carefully. The reason for const'ing those
members is that they cannot be modified, except when initializing the
object. The quick'n'dirty workaround consists in removing "const" from
the declaration of members "f" and "RNode" from beam.h. Please report
in case of further issues.
More information about the Mbdyn-users