OpenLara
OpenLara copied to clipboard
utils.h, typedefs conflicts on OpenBSD workaround
~~``` #ifdef OpenBSD typedef int8_t int8; typedef int16_t int16; typedef int32_t int32; typedef int64_t int64; typedef uint8_t uint8; typedef uint16_t uint16; typedef uint32_t uint32; typedef uint64_t uint64; #else typedef signed char int8; typedef signed short int16; typedef signed int int32; typedef signed long long int64; typedef unsigned char uint8; typedef unsigned short uint16; typedef unsigned int uint32; typedef unsigned long long uint64; #endif~~
why it conflicts?
another day and a another look.. it's these two that is the issue in utils.h:
inline uint16 swap16(uint16 x) {
return ((x & 0x00FF) << 8) | ((x & 0xFF00) >> 8);
}
inline uint32 swap32(uint32 x) {
return ((x & 0x000000FF) << 24) | ((x & 0x0000FF00) << 8) | ((x & 0x00FF0000) >> 8) | ((x & 0xFF000000) >> 24);
}
../../utils.h:160:15: error: 'uint16 __uint16_t' redeclared as different kind of symbol inline uint16 swap16(uint16 x) {
../../utils.h:165:15: error: 'uint32 __uint32_t' redeclared as different kind of symbol inline uint32 swap32(uint32 x) {
workaround:
#ifndef __OpenBSD__
inline uint16 swap16(uint16 x) {
return ((x & 0x00FF) << 8) | ((x & 0xFF00) >> 8);
}
inline uint32 swap32(uint32 x) {
return ((x & 0x000000FF) << 24) | ((x & 0x0000FF00) << 8) | ((x & 0x00FF0000) >> 8) | ((x & 0xFF000000) >> 24);
}
#endif
#ifdef BSD should be better I think. How did you replace linux/*.h headers? I compile game without joystick support, but it crashes on some OGL calls, mesa gl version is 3.2
I've settled for the sdl2 version...i haven't made any effort to try building nix version. If you recommend nix instead i will do so.
no, just my curiosity, I have never worked with BSD systems... maybe I'll try