程序一般默认链接libc,,所以上面的不用指定。
再比如man pthread_create
NAME
pthread_create - create a new thread
SYNOPSIS
#include <pthread.h>
int pthread_create(pthread_t *thread, const pthread_attr_t *attr,
void *(*start_routine) (void *), void *arg);
Compile and link with -pthread.
DESCRIPTION
The pthread_create() function starts a new thread in the calling
process. The new thread starts execution by invoking start_routine();
arg is passed as the sole argument of start_routine().
ubuntu下用man命令就能查看到。
比如man gettimeofday
NAME
gettimeofday, settimeofday -- get/set date and time
LIBRARY
Standard C Library (libc, -lc)
SYNOPSIS
#include <sys/time.h>
int
gettimeofday(struct timeval *tp, struct timezone *tzp);
int
settimeofday(const struct timeval *tp, const struct timezone *tzp);
DESCRIPTION
Note: timezone is no longer used; this information is kept outside the
kernel.
别的linux下应该也写了使用哪个库的吧。你看看。