首页 > 解决方案 > gcc -lnsl 这个标志有什么作用?

问题描述

对不起,noobie 问题,但我无法理解这个.. gcc -lnsl 标志是做什么的。我尝试通过互联网搜索也阅读了有关 rpc 的信息。

标签: gccrpc

解决方案


该标志告诉 gcc 将二进制文件与nsl库链接。更清楚地说,该行gcc -lnsl可以重写为更详细的等价物gcc -l nsl。见man gcc

   -llibrary
   -l library
       Search the library named library when linking.  (The second
       alternative with the library as a separate argument is only for
       POSIX compliance and is not recommended.)

       The -l option is passed directly to the linker by GCC.  Refer to
       your linker documentation for exact details.  The general
       description below applies to the GNU linker.

       The linker searches a standard list of directories for the
       library.  The directories searched include several standard
       system directories plus any that you specify with -L.

推荐阅读