目前,我正在学习Minix,我正在做一个基于线程的系统,不知道如何编译我的程序。
例如:Mthreads.c
#include <stdlib.h>
#include <stdio.h>
#include <minix/mthread.h>
void hola(int y){
printf("Hola Mundo");
}
int main(){
mthread_thread_t a;
mthread_create(&a, NULL, (void*)hola, 0);
mthread_join(a, NULL);
}然后运行clang编译:
# clang Mthreads.c
/var/tmp/g-10649b.o: In function `main':
Mthreads.c:(.text+0x5f): undefined reference to `mthread_create'
Mthreads.c:(.text+0x7d): undefined reference to `mthread_join'
clang: error: linker command failed with exit code 1 (use -v to see invocation)知道该怎么做吗?
发布于 2016-04-28 04:14:51
编译时使用多线程库。试一试,你就能解决你的问题。
clang Mthreads.c -lmthreadhttps://stackoverflow.com/questions/36905017
复制相似问题