问题描述
我正在尝试添加一个新的系统调用:/usr/src/servers/pm/exec.c
我在exec.c
中写了一个非常简单的方法:
void parseBlack(char * value){char * ptr = strtok(values, ";");}
但是,当我尝试编译它时出现错误:
在函数 parseBlac 中,未定义对strtok"的引用.
我添加了 #include
这很奇怪.我检查了 minix api.它有这个方法:
/minix/include/string.h(http://code.metager.de/source/xref/minix/include/string.h)
这是一个屏幕截图:
MINIX 中的服务器不与完整、臃肿和冗长的 libc.a
链接,而是与 C 库的有限版本链接(在您的情况下可能是 libminc
).很明显,strtok
在您使用的版本中不被认为是该有限库的一部分.要么将 strtok.c
移动到该库(编辑 libminc/Makefile
然后清理并重建),或者与 strtok.o
显式链接.>
I am trying to add a new system call at: /usr/src/servers/pm/exec.c
I write a very simple method in exec.c
:
void parseBlack(char * value){
char * ptr = strtok(values, ";");
}
However, when I try to compile it there is an error:
In function parseBlac, undefined reference to "strtok".
And I have added #include <string.h>
It is weird. I checked minix api. It has this method:
/minix/include/string.h(http://code.metager.de/source/xref/minix/include/string.h)
Here is a screen shot:
Servers in MINIX do not link with the full, bloated and verbose libc.a
, rather with a limited version of the C library (probably libminc
in your case). Clearly strtok
was not considered to be part of that limited library in the release you are using. Either move strtok.c
to that library (edit libminc/Makefile
then clean and rebuild), or link explicitly with strtok.o
.
这篇关于Minix:对“strtok"的未定义引用?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!