c - 使用 CC 编译器 (Solaris) 时链接 unistd.h

标签 c solaris cc unistd.h

我需要链接<unistd.h>在我的程序中,在 Solaris 上使用 CC 编译器。当我需要链接 <math.h><curses.h>我刚刚用谷歌找到了-lm-lcurses标志,但这次谷歌没有帮助。如何找出其中lib*something*<unistd.h>位于?

最佳答案

对于任何给定的函数,手册页都会告诉您要包​​含哪些 header 以及要链接哪些库。

例如,the ceil function :

Synopsis

c99 [ flag... ] file... -lm [ library... ]
#include <math.h>

double ceil(double x);

float ceilf(float x);

long double ceill(long double x);

它告诉你 #include <math.h>并链接到-lm .

大多数函数在 <unistd.h> 中声明不需要链接任何其他库,但如有疑问,请查看手册页。

关于c - 使用 CC 编译器 (Solaris) 时链接 unistd.h,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47956154/

相关文章:

c - 为什么 struct int 值没有被传递到下一个函数?

无法使用字符串将 'main' 转换为 'void' 函数

python - 在 Solaris 11.2 上编译 python 3.7 在链接阶段失败

c++ - 如何在 Solaris 上的 BSD 套接字上设置 TCP_NODELAY?

gcc - 无法在 ubuntu 中编译 cc、gcc |没有这样的文件或目录

c - 如何在C中编译时确定宏值?

C、前后自增,不同程序答案不同

c - 这段代码中的 "%d! = %ld' n"是什么意思?

C++ ostream_withassign with << operator 编译错误

c++ - 在UNIX上 “internal compiler error: storage failure”是什么意思?