C程序编译错误:无法找到正确的search.h头文件


我在网上看到段代码,里面使用了 #include <search.h> 中的方法: hcreate , hsearch hdestroy 。但是,我在 mingw lib include 中找到的 search.h 文件却不包含这三个方法,导致编译失败。

编译代码如下:


 #include <search.h>
// Create hash table for fast lookups
hcreate(npages);

分别在mingw的lib和include中都发现了search.h这个头文件,但都没有看到以上三个函数。

我在 http://pubs.opengroup.org/onlinepubs/000095399/basedefs/search.h.html 看到了search.h的定义,貌似,我需要的是这个版本的search.h。

PS: 我是win7系统,使用codeblock来编写C程序。

c mingw

水晶小海豚 10 years, 3 months ago

编译了特定平台的代码,还是需要跑到特定平台下去编译!

星光伴我心 answered 10 years, 3 months ago

有条件还是虚拟机吧
我的mingw还没有<sys/socket.h>呢

AS001 answered 10 years, 3 months ago

文档说用啥就是啥
这东西只是linux上才有的, 在linux上编译即可!

不来一炮么 answered 10 years, 3 months ago

Your Answer