日期:2014-05-16  浏览次数:20528 次

急!同一个c文件里vfork();pthread_create();两个函数,Makefile该怎么写?谢谢
郁闷,两种写法都只能保证vfork();pthread_create();只存在一个的时候能编译过,只要两个函数都在,肯定不行。
两种错误:In   function   '__fork‘:   undefined   reference   to   '__libc_fork '
或者:In   function   'main‘:   undefined   reference   to   'pthread_create '
---
该怎写才能使得两个函数都在的时候,编译通过啊?谢谢

------解决方案--------------------
你用的是哪个编译器?
------解决方案--------------------
我以前用arm-elf-tools-20030314.sh时也遇过这种情况,后来发现:
arm-elf-gcc -Wall -elf2flt test.c -lc -lpthread
其中,-lpthread要在*.c后面,-lc要在-lpthread前面!
多试几次,会通过的!