简体   繁体   English

对mmap和munmap的未定义引用

[英]undefined reference to mmap and munmap

I'm totally newbie in UNIX project compiling. 我是UNIX项目编译的新手。 I need help or advice in using of Cygwin. 我在使用Cygwin时需要帮助或建议。 An errors on "MAKE" command make me upset: “ MAKE”命令上的错误使我不高兴:

/player_module.cpp:96: undefined reference to `mmap'
/player_module.cpp:136: undefined reference to `munmap'

player_module.cpp has includes: player_module.cpp包括:

#include <stdio.h>
#include <string.h>
#include <sys/mman.h>

Invocation code looks like: 调用代码如下:

dump_start = mmap( NULL, sb.st_size, PROT_READ, MAP_SHARED, fileno( file ), 0 );
munmap( dump_start, sb.st_size );

As far as I understand the problem is with sys/mman.h include, but I don't have any clue how to resolve it. 据我了解,问题出在sys / mman.h include,但我不知道如何解决。 Any help would be appreciated. 任何帮助,将不胜感激。

PS. PS。 I don't know anything about UNIX, GCC or things like that, because I do only windows stuff. 我对UNIX,GCC或类似的东西一无所知,因为我只做Windows的事情。

您应该将-lrt添加到链接命令中。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM