Menu

#1 malloc.h compilation errors (and fix) for OS X

open
nobody
None
5
2007-04-15
2007-04-15
No

Here is a very simple detail and fix related to a specific Mac OS X quirk. For this OS, the memory functions are defined in stdlib.h. Including malloc.h actually results in an error when trying to compile code with gcc. Here is a simple fix I use to get around these. I thought I would pass it along in case any of your other OS X users experience this.

This compilation errors occurs because of including malloc.h in the following files:

bioutil/gmem.c
bioutil/mem.c

If you change the following line:

#include <malloc.h>

to:

#ifndef __MACH__
#include <malloc.h>
#endif

the issue is resolved.

Discussion

MongoDB Logo MongoDB