pdollar/toolbox

adding header files for size_t and calloc/malloc

huahandsome opened this issue · 0 comments

Here looks like a bug in header file: wrappers.hpp

If you disable "MATLAB_MEX_FILE", when building imResamplexxx.cpp, which requires the header file "wrappers.hpp", there is an error:

wrappers.hpp:12:24: error: ‘wrCalloc’ declared as an ‘inline’ variable
inline void* wrCalloc( size_t num, size_t size ) { return calloc(num,size); }
^
wrappers.hpp:12:24: error: ‘size_t’ was not declared in this scope
wrappers.hpp:12:36: error: ‘size_t’ was not declared in this scope
inline void* wrCalloc( size_t num, size_t size ) { return calloc(num,size); }
^
wrappers.hpp:12:48: error: expression list treated as compound expression in initializer [-fpermissive]
inline void* wrCalloc( size_t num, size_t size ) { return calloc(num,size); }
^
wrappers.hpp:12:50: error: expected ‘,’ or ‘;’ before ‘{’ token
inline void* wrCalloc( size_t num, size_t size ) { return calloc(num,size); }
^
wrappers.hpp:13:24: error: ‘wrMalloc’ declared as an ‘inline’ variable
inline void* wrMalloc( size_t size ) { return malloc(size); }
^
wrappers.hpp:13:24: error: ‘size_t’ was not declared in this scope
wrappers.hpp:13:38: error: expected ‘,’ or ‘;’ before ‘{’ token
inline void* wrMalloc( size_t size ) { return malloc(size); }
^
wrappers.hpp: In function ‘void wrFree(void*)’:
wrappers.hpp:14:44: error: ‘free’ was not declared in this scope
inline void wrFree( void * ptr ) { free(ptr); }
^
wrappers.hpp: At global scope:
wrappers.hpp:17:17: error: ‘size_t’ was not declared in this scope
void* alMalloc( size_t size, int alignment ) {
^
wrappers.hpp:17:30: error: expected primary-expression before ‘int’
void* alMalloc( size_t size, int alignment ) {
^
wrappers.hpp:17:44: error: expression list treated as compound expression in initializer [-fpermissive]
void* alMalloc( size_t size, int alignment ) {
^
wrappers.hpp:17:46: error: expected ‘,’ or ‘;’ before ‘{’ token
void* alMalloc( size_t size, int alignment ) {

This error can be fixed by adding the two header files:
#include <stdio.h>
#include <stdlib.h>

Please help review and confirm.

Thanks,

Shuai Hua