简体   繁体   English

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

[英]Linking unistd.h when using CC compiler (Solaris)

I need to link <unistd.h> in my program using CC compiler on Solaris. 我需要在Solaris上使用CC编译器在程序中链接<unistd.h> When I needed to link <math.h> or <curses.h> I just used Google to find -lm and -lcurses flags but this time Google didn't help. 当我需要链接<math.h><curses.h>我只是使用Google查找-lm-lcurses标志,但是这次Google没有帮助。 How to find out in which lib*something* is <unistd.h> located? 如何找出<unistd.h>位于哪个lib*something*

For any given function, the man page tells you both what headers to include and what libraries to link. 对于任何给定的函数,手册页都会告诉您要包​​括的标题和要链接的库。

For example, the ceil function : 例如, ceil函数

Synopsis 概要

 c99 [ flag... ] file... -lm [ library... ] #include <math.h> double ceil(double x); float ceilf(float x); long double ceill(long double x); 

It tells you to #include <math.h> and to link with -lm . 它告诉您#include <math.h>并与-lm链接。

Most functions declared in <unistd.h> don't require any additional libraries to link in, but when in doubt check the man pages. <unistd.h>声明的大多数函数不需要链接任何其他库,但是有疑问时请检查手册页。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM