小编ice*_*e03的帖子

clock_gettime() 未定义符号 SunOS

我正在尝试构建一个需要 2 个时间戳的程序:第一个进程结束时的时间戳,然后是第二个进程开始时的时间戳。然后求两者的差值。

但我无法编译,因为链接器抱怨clock_gettime,给出了未定义的符号错误。

gcc (GCC) 3.2.1
Copyright (C) 2002 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
Run Code Online (Sandbox Code Playgroud)
gcc (GCC) 3.2.1
Copyright (C) 2002 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
Run Code Online (Sandbox Code Playgroud)

这是编译器(链接器)错误:

gcc -Wall -o time ./time.c …
Run Code Online (Sandbox Code Playgroud)

c unix solaris sunos

3
推荐指数
1
解决办法
995
查看次数

标签 统计

c ×1

solaris ×1

sunos ×1

unix ×1