$ make gcc -o 4gExe CC1200.o l4g.o l4g_mib.o l4g_rf_S5Sx24.o l4g_rf_SERIES5_SBS.o l4g_tmr.o l4g_tmr_SERIES5_SBS.o l4g_tmr_TEPCO.o l4G_unit_test.o RegionCode.o mai.o RTOS-linux.o -Wall -I ./include -I ./common RTOS-linux.o: In function `OS_CreateRSema': RTOS-linux.c:(.text+0x11): undefined reference to `pthread_mutexattr_init' RTOS-linux.c:(.text+0x25): undefined reference to `pthread_mutexattr_setprotocol' RTOS-linux.c:(.text+0x39): undefined reference to `pthread_mutexattr_settype' RTOS-linux.o: In function `OS_SignalCSema': RTOS-linux.c:(.text+0x99): undefined reference to `sem_post' RTOS-linux.o: In function `OS_WaitCSema': RTOS-linux.c:(.text+0xb0): undefined reference to `sem_wait' RTOS-linux.o: In function `OS_CreateCSema': RTOS-linux.c:(.text+0xcc): undefined reference to `sem_init' RTOS-linux.o: In function `ev_waitevents': RTOS-linux.c:(.text+0x173): undefined reference to `sem_wait' RTOS-linux.c:(.text+0x209): undefined reference to `sem_timedwait' RTOS-linux.o: In function `OS_SignalEvent': RTOS-linux.c:(.text+0x398): undefined reference to `sem_post' RTOS-linux.o: In function `OS_CreateTimer': RTOS-linux.c:(.text+0xc39): undefined reference to `timer_create' RTOS-linux.o: In function `OS_StartTimer': RTOS-linux.c:(.text+0xcc4): undefined reference to `timer_settime' RTOS-linux.o: In function `OS_CreateTask': RTOS-linux.c:(.text+0xf17): undefined reference to `pthread_attr_setstack' RTOS-linux.c:(.text+0xfae): undefined reference to `pthread_create' collect2: error: ld returned 1 exit status Makefile:19: recipe for target '4gExe' failed make: *** [4gExe] Error 1 [krishna]$
答案 0 :(得分:1)
在我看来,您并没有在gcc命令中链接您正在使用的库。
尝试将-lpthread添加到命令的末尾