[haiku-3rdparty-dev] Problem with stdint.h

  • From: Fredrik Modèen <fredrik@xxxxxxxxx>
  • To: haiku-3rdparty-dev@xxxxxxxxxxxxx
  • Date: Fri, 18 May 2012 20:45:37 +0200 (CEST)

Hi

I have a problem porting a program. I would like to use stdint.h that the
program itself uses.

port.h has these lines.
#ifdef HAVE_STDINT_H
#include <stdint.h>
typedef intptr_t                        pint;
typedef int8_t                          int8;
typedef uint8_t                         uint8;
typedef int16_t                         int16;
typedef uint16_t                        uint16;
typedef int32_t                         int32;
typedef uint32_t                        uint32;
typedef int64_t                         int64;
typedef uint64_t                        uint64;
#else   // HAVE_STDINT_H

That will give me these errors.
../port.h:227:20: error: conflicting declaration 'typedef int32_t int32'
/boot/develop/headers/os/support/SupportDefs.h:24:25: error: 'int32' has a
previous declaration as 'typedef __haiku_int32 int32'
../port.h:228:20: error: conflicting declaration 'typedef uint32_t uint32'
/boot/develop/headers/os/support/SupportDefs.h:25:26: error: 'uint32' has
a previous declaration as 'typedef __haiku_uint32 uint32'
S9xApp.cpp: In member function 'BWindow* S9xApp::GetWindow()':
S9xApp.cpp:36:1: warning: control reaches end of non-void function
[-Wreturn-type]
make: *** [objects.x86-gcc4-release/S9xApp.o] Error 1


an older BeOS port has typed int32 and uint32
#ifdef HAVE_STDINT_H
#include <stdint.h>
typedef intptr_t                        pint;
typedef int8_t                          int8;
typedef uint8_t                         uint8;
typedef int16_t                         int16;
typedef uint16_t                        uint16;
typedef int64_t                         int64;
typedef uint64_t                        uint64;
#ifdef __HAIKU__
typedef long    int32;
typedef unsigned long uint32;
#else
typedef int32_t                         int32;
typedef uint32_t                        uint32;
#endif
#else   // HAVE_STDINT_H

This will give me (some of them.. other are warnings).
../memmap.cpp:3693:50: error: invalid initialization of reference of type
'unsigned int&' from expression of type 'uint32 {aka long unsigned int}'
../memmap.cpp:3638:15: error: in passing argument 2 of 'uint32
ReadUPSPointer(const uint8*, unsigned int&, unsigned int)'
../memmap.cpp:3694:50: error: invalid initialization of reference of type
'unsigned int&' from expression of type 'uint32 {aka long unsigned int}'
../memmap.cpp:3638:15: error: in passing argument 2 of 'uint32
ReadUPSPointer(const uint8*, unsigned int&, unsigned int)'
../memmap.cpp:3706:46: error: invalid initialization of reference of type
'unsigned int&' from expression of type 'uint32 {aka long unsigned int}'
../memmap.cpp:3638:15: error: in passing argument 2 of 'uint32
ReadUPSPointer(const uint8*, unsigned int&, unsigned int)'

So any idés are welcome :)
-- 
MVH
Fredrik Modèen


Other related posts: