error in cl_platform.h with MinGW

DFooz
Posts: 2
Joined: Mon Feb 08, 2010 8:33 pm

error in cl_platform.h with MinGW

Post by DFooz »

I' ve downloaded 2.16 http://code.google.com/p/bullet/downloads/list. This error also must be in 2.17 beta.
On windows i'm using MinGW. When i was compiling demos i had an error /bullet-2.75/src/MiniCL/cl_platform.h:47: error: `__int8' does not name a type.
The problem was in block #ifdef _WIN32. MinGW has already types int*_t; but hasn't types __int*, it's only for VisualStudio.
And this block doesn't work

Code: Select all

typedef signed   __int8  int8_t;
typedef unsigned __int8  uint8_t;
typedef signed   __int16 int16_t;
typedef unsigned __int16 uint16_t;
typedef signed   __int32 int32_t;
typedef unsigned __int32 uint32_t;
typedef signed   __int64 int64_t;
typedef unsigned __int64 uint64_t;
****************************

Then we have code for Unix platforms(gcc compiler)

Code: Select all

[color=#BF0000]#else
#include <stdint.h>[/color]

/* scalar types  */
typedef int8_t          cl_char;
typedef uint8_t         cl_uchar;
typedef int16_t         cl_short    __attribute__((aligned(2)));
typedef uint16_t        cl_ushort   __attribute__((aligned(2)));
typedef int32_t         cl_int      __attribute__((aligned(4)));
typedef uint32_t        cl_uint     __attribute__((aligned(4)));
typedef int64_t         cl_long     __attribute__((aligned(8)));
typedef uint64_t        cl_ulong    __attribute__((aligned(8)));
But this code must be also for MinGW(gcc compiler)

Original file
#ifndef __CL_PLATFORM_H
#define __CL_PLATFORM_H

*************************************

#ifdef _WIN32
typedef signed __int8 int8_t;
typedef unsigned __int8 uint8_t;
typedef signed __int16 int16_t;
typedef unsigned __int16 uint16_t;
typedef signed __int32 int32_t;
typedef unsigned __int32 uint32_t;
typedef signed __int64 int64_t;
typedef unsigned __int64 uint64_t;

typedef int8_t cl_char;
typedef uint8_t cl_uchar;
*************************

#else
#include <stdint.h>


/* scalar types */
typedef int8_t cl_char;
typedef uint8_t cl_uchar;
typedef int16_t cl_short __attribute__((aligned(2)));
typedef uint16_t cl_ushort __attribute__((aligned(2)));
typedef int32_t cl_int __attribute__((aligned(4)));
typedef uint32_t cl_uint __attribute__((aligned(4)));
typedef int64_t cl_long __attribute__((aligned(8)));
typedef uint64_t cl_ulong __attribute__((aligned(8)));
*********************************
#endif

#include <stddef.h>
*********************************
#ifdef __cplusplus
}
#endif
#endif // __CL_PLATFORM_H

When i've swaped this blocks all was OK for MinGW.
*************************************
//#ifdef WIN32
#ifdef __MINGW32__
#include <stdint.h>


/* scalar types */
typedef int8_t cl_char;
typedef uint8_t cl_uchar;
typedef int16_t cl_short __attribute__((aligned(2)));
typedef uint16_t cl_ushort __attribute__((aligned(2)));
typedef int32_t cl_int __attribute__((aligned(4)));
typedef uint32_t cl_uint __attribute__((aligned(4)));
typedef int64_t cl_long __attribute__((aligned(8)));
typedef uint64_t cl_ulong __attribute__((aligned(8)));
*********************************

#else
typedef signed __int8 int8_t;
typedef unsigned __int8 uint8_t;
typedef signed __int16 int16_t;
typedef unsigned __int16 uint16_t;
typedef signed __int32 int32_t;
typedef unsigned __int32 uint32_t;
typedef signed __int64 int64_t;
typedef unsigned __int64 uint64_t;

typedef int8_t cl_char;
typedef uint8_t cl_uchar;
*************************
#endif

#include <stddef.h>
*********************************
#ifdef __cplusplus
}
#endif
#endif // __CL_PLATFORM_H
User avatar
Erwin Coumans
Site Admin
Posts: 4221
Joined: Sun Jun 26, 2005 6:43 pm
Location: California, USA

Re: error in cl_platform.h with MinGW

Post by Erwin Coumans »

Thanks for the report, we should fix this.

Where does the 2.16 and 2.17 come from? The latest Bullet beta is version 2.76.

Thanks,
Erwin
User avatar
Erwin Coumans
Site Admin
Posts: 4221
Joined: Sun Jun 26, 2005 6:43 pm
Location: California, USA

Re: error in cl_platform.h with MinGW

Post by Erwin Coumans »

How about replacing

Code: Select all

#if defined (_WIN32)
by

Code: Select all

#if defined (_WIN32) && ! defined (__MINGW32__)
Do you have a patch that doesn't break _WIN32 support?
Thanks,
Erwin
DFooz
Posts: 2
Joined: Mon Feb 08, 2010 8:33 pm

Re: error in cl_platform.h with MinGW

Post by DFooz »

Where does the 2.16 and 2.17 come from? The latest Bullet beta is version 2.76.
Yes, 2.75 and 2.76. i was mistaken.

Code: Select all

#if defined (_WIN32) && ! defined (__MINGW32__)
It works. I've compiled with VS and Mingw.