-Bprefix

本文介绍了 GCC 编译器中 -B 选项的作用及使用方法。-B 选项用于指定编译器查找可执行文件、库文件、头文件和数据文件的位置。文章详细解释了如何通过 -B 选项设置路径前缀,并说明了这一选项如何影响编译过程中各个子程序的调用。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

-Bprefix
                      This   option   specifies   where   to   find   the   executables,   libraries,
                      include   files,   and   data   files   of   the   compiler   itself.

                      The   compiler   driver   program   runs   one   or   more   of   the   subprograms
                      cpp,   cc1,   as   and   ld.     It   tries   prefix   as   a   prefix   for   each   program
                      it   tries   to   run,   both   with   and   without   machine/version/.

                      For   each   subprogram   to   be   run,   the   compiler   driver   first   tries   the
                      -B   prefix,   if   any.     If   that   name   is   not   found,   or   if   -B   was   not
                      specified,   the   driver   tries   two   standard   prefixes,   which   are
                      /usr/lib/gcc/   and   /usr/local/lib/gcc/.     If   neither   of   those   results
                      in   a   file   name   that   is   found,   the   unmodified   program   name   is
                      searched   for   using   the   directories   specified   in   your   PATH   environ-
                      ment   variable.

                      The   compiler   will   check   to   see   if   the   path   provided   by   the   -B
                      refers   to   a   directory,   and   if   necessary   it   will   add   a   directory
                      separator   character   at   the   end   of   the   path.

                      -B   prefixes   that   effectively   specify   directory   names   also   apply   to
                      libraries   in   the   linker,   because   the   compiler   translates   these
                      options   into   -L   options   for   the   linker.     They   also   apply   to
includes   files   in   the   preprocessor,   because   the   compiler   translates
                      these   options   into   -isystem   options   for   the   preprocessor.     In   this
                      case,   the   compiler   appends   include   to   the   prefix.

                      The   run-time   support   file   libgcc.a   can   also   be   searched   for   using
                      the   -B   prefix,   if   needed.     If   it   is   not   found   there,   the   two   stan-
                      dard   prefixes   above   are   tried,   and   that   is   all.     The   file   is   left
                      out   of   the   link   if   it   is   not   found   by   those   means.

                      Another   way   to   specify   a   prefix   much   like   the   -B   prefix   is   to   use
                      the   environment   variable   GCC_EXEC_PREFIX.

                      As   a   special   kludge,   if   the   path   provided   by   -B   is   [dir/]stageN/,
                      where   N   is   a   number   in   the   range   0   to   9,   then   it   will   be   replaced
                      by   [dir/]include.     This   is   to   help   with   boot-strapping   the   com-
                      piler.
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值