Skip to content

Commit a1ea017

Browse files
neoasceticZeno-
authored andcommittedDec 9, 2014
Fix builds failing on BSD-like (such as OSX) due to an irrlicht bug (temporary fix)
Details: - https://sourceforge.net/p/irrlicht/bugs/433/ - #1687 (comment) - https://forum.minetest.net/viewtopic.php?f=42&t=9190&start=125#p159364 In case when "settings.h" is included from "emerge.cpp" or "environment.cpp", u64 type has "unsigned long" length because previously <stdint> was included. When "settings.h" is included from "settings.cpp", u64 has "unsigned long long" length because no <stdint> was included previously. This leads to different signatures of "setU64" method and linker cannot find appropriate symbol. The best fix of this bug should be done in the Irrlicht, but as hotfix I think this is OK and better than types changing. Previously this bug didn't appear because there was no "settings.cpp" file and implementation of all methods was done in the header file.
1 parent 941d000 commit a1ea017

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed
 

‎src/irrlichttypes.h

+11-2
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,17 @@ with this program; if not, write to the Free Software Foundation, Inc.,
2020
#ifndef IRRLICHTTYPES_HEADER
2121
#define IRRLICHTTYPES_HEADER
2222

23+
/* Ensure that <stdint.h> is included before <irrTypes.h>, unless building on
24+
* MSVC, to address an irrlicht issue: https://sourceforge.net/p/irrlicht/bugs/433/
25+
*
26+
* TODO: Decide whether or not we support non-compliant C++ compilers like old
27+
* versions of MSCV. If we do not then <stdint.h> can always be included
28+
* regardless of the compiler.
29+
*/
30+
#ifndef _MSC_VER
31+
# include <stdint.h>
32+
#endif
33+
2334
#include <irrTypes.h>
2435

2536
using namespace irr;
@@ -32,11 +43,9 @@ using namespace irr;
3243
typedef unsigned long long u64;
3344
#else
3445
// Posix
35-
#include <stdint.h>
3646
typedef int64_t s64;
3747
typedef uint64_t u64;
3848
#endif
3949
#endif
4050

4151
#endif
42-

0 commit comments

Comments
 (0)
Please sign in to comment.