mingw32缺少posix_memalign函数

Posted by ngtmuzi on 2015-11-30
神秘代码

想在windows上研究word2vec,于是查了一下如何make之类的东西,装好mingw32之后编译的时候总是报错说找不到这个函数,查了半天百度,结论大概就是没有,不过有类似的函数_aligned_malloc,但是参数格式不一样,那还是自己动手吧:

1
2
3
function posix_memalign( void ** memptr, size_t alignment, size_t size){
(* memptr) = _aligned_malloc(size, alignment);
}

这样就可以编译通过了