Minix:对“strtok"的未定义引用? [英] Minix: undefined reference to 'strtok'?

查看:59
本文介绍了Minix:对“strtok"的未定义引用?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试添加一个新的系统调用:/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"的未定义引用?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆