[MOAB-dev] MOAB build on windows
Steve Jackson
sjackson at cae.wisc.edu
Mon Aug 24 10:56:35 CDT 2009
M_PI is not part of the C/C++ standard, though I believe it's mandated under POSIX.
GCC defines it by default in the math header, but Visual Studio doesn't.
To get constants like M_PI in the Visual Studio compiler, the prescribed method is:
#define _USE_MATH_DEFINES
#include <cmath>
Note that the order of the two statements is important.
For more info see [ http://msdn.microsoft.com/en-us/library/4hwaceh6(VS.80).aspx ].
~S
On Sat, Aug 22, 2009 at 04:23:10PM -0400, Alfred von Loebbecke wrote:
> ok, thank you for all the help.
> I'm getting one other error inside dagmc:
>
> /tools/dagmc/DagMC.cpp(451): error C2065: 'M_PI' : undeclared identifier
> is this the actual value of Pi?
> thanks again and regards,
> Alfred
>
>
> James Porter wrote:
>> On Thu, 2009-08-20 at 15:26 -0500, Jason Kraftcheck wrote:
>>
>>> #ifdef _MSC_VER
>>> typedef unsigned _int16 uint16_t
>>> #endif
>>>
>>
>> This is already in MBSysUtil.cpp, but the "hard" part is dealing with
>> non-default configurations on Windows, such as #defining
>> MOAB_FORCE_64_BIT_HANDLES. That'll probably fail since it uses int64_t
>> in MBEntityHandle.h, which isn't defined on Windows either. It looks
>> like everything that #includes stdint.h also includes MBEntityHandle.h,
>> so I think we should consolidate the inclusions/typedefs to that file.
>>
>>
>>> #ifdef _MSC_VER
>>> #define finite _finite
>>> #endif
>>>
>>
>> This also runs the risk of us redefining C99 extensions piecemeal. We
>> can probably do this for now, but it's something we should keep in mind
>> if we start using more C99 features.
>>
>> - Jim
>>
>
>
More information about the moab-dev
mailing list