百度360必应搜狗淘宝本站头条
当前位置:网站首页 > 热门文章 > 正文

跟老韩学Ubuntu Server 2204-gcc指令帮助手册04节

bigegpt 2024-08-05 11:53 14 浏览

1、GCC介绍

GCC:GNU Compiler Collection(GNU 编译器集合),它可以编译C、C++、JAV、Fortran、Pascal、Object-C等语言。

gcc是GCC中的GUN C Compiler(C 编译器)。


g++是GCC中的GUN C++ Compiler(C++编译器)。

2、GCC man手册

如下为gcc的man帮助手册的第2部分(第546~746行)。

546           files, or into one assembler input file; then each assembler input file produces an object file, and linking
547           combines all the object files (those newly compiled, and those specified as input) into an executable file.
548           For any given input file, the file name suffix determines what kind of compilation is done:
549           file.c
550               C source code that must be preprocessed.
551           file.i
552               C source code that should not be preprocessed.
553           file.ii
554               C++ source code that should not be preprocessed.
555           file.m
556               Objective-C source code.  Note that you must link with the libobjc library to make an Objective-C program
557               work.
558           file.mi
559               Objective-C source code that should not be preprocessed.
560           file.mm
561           file.M
562               Objective-C++ source code.  Note that you must link with the libobjc library to make an Objective-C++
563               program work.  Note that .M refers to a literal capital M.
564           file.mii
565               Objective-C++ source code that should not be preprocessed.
566           file.h
567               C, C++, Objective-C or Objective-C++ header file to be turned into a precompiled header (default), or C,
568               C++ header file to be turned into an Ada spec (via the -fdump-ada-spec switch).
569           file.cc
570           file.cp
571           file.cxx
572           file.cpp
573           file.CPP
574           file.c++
575           file.C
576               C++ source code that must be preprocessed.  Note that in .cxx, the last two letters must both be literally
577               x.  Likewise, .C refers to a literal capital C.
578           file.mm
579           file.M
580               Objective-C++ source code that must be preprocessed.
581           file.mii
582               Objective-C++ source code that should not be preprocessed.
583           file.hh
584           file.H
585           file.hp
586           file.hxx
587           file.hpp
588           file.HPP
589           file.h++
590           file.tcc
591               C++ header file to be turned into a precompiled header or Ada spec.
592           file.f
593           file.for
594           file.ftn
595               Fixed form Fortran source code that should not be preprocessed.
596           file.F
597           file.FOR
598           file.fpp
599           file.FPP
600           file.FTN
601               Fixed form Fortran source code that must be preprocessed (with the traditional preprocessor).
602           file.f90
603           file.f95
604           file.f03
605           file.f08
606               Free form Fortran source code that should not be preprocessed.
607           file.F90
608           file.F95
609           file.F03
610           file.F08
611               Free form Fortran source code that must be preprocessed (with the traditional preprocessor).
612           file.go
613               Go source code.
614           file.brig
615               BRIG files (binary representation of HSAIL).
616           file.d
617               D source code.
618           file.di
619               D interface file.
620           file.dd
621               D documentation code (Ddoc).
622           file.ads
623               Ada source code file that contains a library unit declaration (a declaration of a package, subprogram, or
624               generic, or a generic instantiation), or a library unit renaming declaration (a package, generic, or
625               subprogram renaming declaration).  Such files are also called specs.
626           file.adb
627               Ada source code file containing a library unit body (a subprogram or package body).  Such files are also
628               called bodies.
629           file.s
630               Assembler code.
631           file.S
632           file.sx
633               Assembler code that must be preprocessed.
634           other
635               An object file to be fed straight into linking.  Any file name with no recognized suffix is treated this
636               way.
637           You can specify the input language explicitly with the -x option:
638           -x language
639               Specify explicitly the language for the following input files (rather than letting the compiler choose a
640               default based on the file name suffix).  This option applies to all following input files until the next -x
641               option.  Possible values for language are:
642                       c  c-header  cpp-output
643                       c++  c++-header  c++-system-header c++-user-header c++-cpp-output
644                       objective-c  objective-c-header  objective-c-cpp-output
645                       objective-c++ objective-c++-header objective-c++-cpp-output
646                       assembler  assembler-with-cpp
647                       ada
648                       d
649                       f77  f77-cpp-input f95  f95-cpp-input
650                       go
651                       brig
652           -x none
653               Turn off any specification of a language, so that subsequent files are handled according to their file name
654               suffixes (as they are if -x has not been used at all).
655           If you only want some of the stages of compilation, you can use -x (or filename suffixes) to tell gcc where to
656           start, and one of the options -c, -S, or -E to say where gcc is to stop.  Note that some combinations (for
657           example, -x cpp-output -E) instruct gcc to do nothing at all.
658           -c  Compile or assemble the source files, but do not link.  The linking stage simply is not done.  The ultimate
659               output is in the form of an object file for each source file.
660               By default, the object file name for a source file is made by replacing the suffix .c, .i, .s, etc., with
661               .o.
662               Unrecognized input files, not requiring compilation or assembly, are ignored.
663           -S  Stop after the stage of compilation proper; do not assemble.  The output is in the form of an assembler
664               code file for each non-assembler input file specified.
665               By default, the assembler file name for a source file is made by replacing the suffix .c, .i, etc., with
666               .s.
667               Input files that don't require compilation are ignored.
668           -E  Stop after the preprocessing stage; do not run the compiler proper.  The output is in the form of
669               preprocessed source code, which is sent to the standard output.
670               Input files that don't require preprocessing are ignored.
671           -o file
672               Place the primary output in file file.  This applies to whatever sort of output is being produced, whether
673               it be an executable file, an object file, an assembler file or preprocessed C code.
674               If -o is not specified, the default is to put an executable file in a.out, the object file for
675               source.suffix in source.o, its assembler file in source.s, a precompiled header file in source.suffix.gch,
676               and all preprocessed C source on standard output.
677               Though -o names only the primary output, it also affects the naming of auxiliary and dump outputs.  See the
678               examples below.  Unless overridden, both auxiliary outputs and dump outputs are placed in the same
679               directory as the primary output.  In auxiliary outputs, the suffix of the input file is replaced with that
680               of the auxiliary output file type; in dump outputs, the suffix of the dump file is appended to the input
681               file suffix.  In compilation commands, the base name of both auxiliary and dump outputs is that of the
682               primary output; in compile and link commands, the primary output name, minus the executable suffix, is
683               combined with the input file name.  If both share the same base name, disregarding the suffix, the result
684               of the combination is that base name, otherwise, they are concatenated, separated by a dash.
685                       gcc -c foo.c ...
686               will use foo.o as the primary output, and place aux outputs and dumps next to it, e.g., aux file foo.dwo
687               for -gsplit-dwarf, and dump file foo.c.???r.final for -fdump-rtl-final.
688               If a non-linker output file is explicitly specified, aux and dump files by default take the same base name:
689                       gcc -c foo.c -o dir/foobar.o ...
690               will name aux outputs dir/foobar.* and dump outputs dir/foobar.c.*.
691               A linker output will instead prefix aux and dump outputs:
692                       gcc foo.c bar.c -o dir/foobar ...
693               will generally name aux outputs dir/foobar-foo.* and dir/foobar-bar.*, and dump outputs dir/foobar-foo.c.*
694               and dir/foobar-bar.c.*.
695               The one exception to the above is when the executable shares the base name with the single input:
696                       gcc foo.c -o dir/foo ...
697               in which case aux outputs are named dir/foo.* and dump outputs named dir/foo.c.*.
698               The location and the names of auxiliary and dump outputs can be adjusted by the options -dumpbase,
699               -dumpbase-ext, -dumpdir, -save-temps=cwd, and -save-temps=obj.
700           -dumpbase dumpbase
701               This option sets the base name for auxiliary and dump output files.  It does not affect the name of the
702               primary output file.  Intermediate outputs, when preserved, are not regarded as primary outputs, but as
703               auxiliary outputs:
704                       gcc -save-temps -S foo.c
705               saves the (no longer) temporary preprocessed file in foo.i, and then compiles to the (implied) output file
706               foo.s, whereas:
707                       gcc -save-temps -dumpbase save-foo -c foo.c
708               preprocesses to in save-foo.i, compiles to save-foo.s (now an intermediate, thus auxiliary output), and
709               then assembles to the (implied) output file foo.o.
710               Absent this option, dump and aux files take their names from the input file, or from the (non-linker)
711               output file, if one is explicitly specified: dump output files (e.g. those requested by -fdump-* options)
712               with the input name suffix, and aux output files (those requested by other non-dump options, e.g.
713               "-save-temps", "-gsplit-dwarf", "-fcallgraph-info") without it.
714               Similar suffix differentiation of dump and aux outputs can be attained for explicitly-given -dumpbase
715               basename.suf by also specifying -dumpbase-ext .suf.
716               If dumpbase is explicitly specified with any directory component, any dumppfx specification (e.g. -dumpdir
717               or -save-temps=*) is ignored, and instead of appending to it, dumpbase fully overrides it:
718                       gcc foo.c -c -o dir/foo.o -dumpbase alt/foo \
719                         -dumpdir pfx- -save-temps=cwd ...
720               creates auxiliary and dump outputs named alt/foo.*, disregarding dir/ in -o, the ./ prefix implied by
721               -save-temps=cwd, and pfx- in -dumpdir.
722               When -dumpbase is specified in a command that compiles multiple inputs, or that compiles and then links, it
723               may be combined with dumppfx, as specified under -dumpdir.  Then, each input file is compiled using the
724               combined dumppfx, and default values for dumpbase and auxdropsuf are computed for each input file:
725                       gcc foo.c bar.c -c -dumpbase main ...
726               creates foo.o and bar.o as primary outputs, and avoids overwriting the auxiliary and dump outputs by using
727               the dumpbase as a prefix, creating auxiliary and dump outputs named main-foo.*  and main-bar.*.
728               An empty string specified as dumpbase avoids the influence of the output basename in the naming of
729               auxiliary and dump outputs during compilation, computing default values :
730                       gcc -c foo.c -o dir/foobar.o -dumpbase " ...
731               will name aux outputs dir/foo.* and dump outputs dir/foo.c.*.  Note how their basenames are taken from the
732               input name, but the directory still defaults to that of the output.
733               The empty-string dumpbase does not prevent the use of the output basename for outputs during linking:
734                       gcc foo.c bar.c -o dir/foobar -dumpbase " -flto ...
735               The compilation of the source files will name auxiliary outputs dir/foo.* and dir/bar.*, and dump outputs
736               dir/foo.c.* and dir/bar.c.*.  LTO recompilation during linking will use dir/foobar. as the prefix for dumps
737               and auxiliary files.
738           -dumpbase-ext auxdropsuf
739               When forming the name of an auxiliary (but not a dump) output file, drop trailing auxdropsuf from dumpbase
740               before appending any suffixes.  If not specified, this option defaults to the suffix of a default dumpbase,
741               i.e., the suffix of the input file when -dumpbase is not present in the command line, or dumpbase is
742               combined with dumppfx.
743                       gcc foo.c -c -o dir/foo.o -dumpbase x-foo.c -dumpbase-ext .c ...
744               creates dir/foo.o as the main output, and generates auxiliary outputs in dir/x-foo.*, taking the location
745               of the primary output, and dropping the .c suffix from the dumpbase.  Dump outputs retain the suffix:
746               dir/x-foo.c.*.

相关推荐

恢复软件6款汇总推荐,帮你减轻数据恢复压力!

在当今数字化生活中,数据丢失的风险如影随形。无论是误删文件、硬盘故障,还是遭遇病毒攻击,丢失的数据都可能给我们带来不小的麻烦。此时,一款优秀的数据恢复软件就成为了挽救数据的关键。今天,为大家汇总推荐...

中兴星星一号刷回官方原版recovery的教程

【搞科技教程】中兴星星一号的官方recovery也来说一下了,因为之前给大家分享过了第三方的recovery了,之前给大家分享的第三方recovery也是采用一键刷入的方式,如果细心的朋友会发现,之前...

新玩机工具箱,Uotan柚坛工具箱软件体验

以前的手机系统功能比较单调,各厂商的重视程度不一样,所以喜欢玩机的朋友会解锁手机系统的读写权限,来进行刷机或者ROOT之类的操作,让使用体验更好。随着现在的手机系统越来越保守,以及自身功能的增强,...

三星g906k刷recovery教程_三星g906k中文recovery下载

【搞科技教程】看到有一些机友在找三星g906k的第三方recovery,下面就来说一下详细的recovery的刷入方法了,因为手机只有有了第三方的recovery之后才可以刷第三方的root包和系统包...

中兴星星2号刷recovery教程_星星二号中文recovery下载

【搞科技教程】咱们的中兴星星2手机也就是中兴星星二号手机的第三方recovery已经出来了,并且是中文版的,有了这个recovery之后,咱们的手机就可以轻松的刷第三方的系统包了,如果没有第三方的re...

数据恢复软件有哪些值得推荐?这 6 款亲测好用的工具汇总请收好!

在数字生活中,数据丢失的阴霾常常突如其来。无论是误删工作文档、格式化重要磁盘,还是遭遇系统崩溃,都可能让我们陷入焦虑。关键时刻,一款得力的数据恢复软件便是那根“救命稻草”。今天,为大家精心汇总6...

中兴u956刷入recovery的教程(中兴e5900刷机)

【搞科技教程】这次主要来给大家说说中兴u956手机如何刷入第三方的recovery,因为第三方的recovery工具是咱们刷第三方rom包的基础,可是很我欠却不会刷,所以太这里来给大家整理了一下详细的...

联想A850+刷recovery教程 联想A850+第三方recovery下载

【搞科技教程】联想A850+的第三方recovery出来了,这个第三方的recovery是非常的重要的,比如咱们的手机要刷第三方的系统包的时候,都是需要用到这个第三方的recovery的,在网上也是有...

工具侠重大更新 智能机上刷机一条龙完成

工具侠是针对玩机的机油开发的一款工具,不管是发烧级别的粉丝,还是普通小白用户,都可以在工具侠上找到你喜欢的工具应用。这不,最新的工具侠2.0.16版本,更新了专门为小白准备的刷机助手工具,以及MTK超...

shift+delete删除的文件找回6种硬盘数据恢复工具

硬盘作为电脑的重要存储设备,如同一个巨大的数字仓库,承载着我们日常工作、学习和生活中的各种文件,从珍贵的照片、重要的工作文档到喜爱的视频、音乐等,都依赖硬盘来安全存放。但有时,我们可能会不小心用sh...

使用vscode+Deepseek 实现AI编程 基于Cline和continue

尊敬的诸位!我是一名专注于嵌入式开发的物联网工程师。关注我,持续分享最新物联网与AI资讯和开发实战。期望与您携手探寻物联网与AI的无尽可能。这两天deepseek3.0上线,据说编程能力比肩Cl...

详解如何使用VSCode搭建TypeScript环境(适合小白)

搭建Javascript环境因为TypeScript不能直接在浏览器上运行。它需要编译器来编译并生成JavaScript文件。所以需要首先安装好javascript环境,可以参考文章:https://...

使用VSCode来书写你的Jupyter Notebooks

现在你可以在VScode里面来书写你的notebook了,使用起来十分的方便。下面来给大家演示一下环境的搭建。首先需要安装一个jupyter的包,使用下面的命令安装:pip3install-ih...

使用VSCode模板提高Vue开发效率(vscode开发vue插件)

安装VSCode安装Vetur和VueHelper插件,安装完成后需要重启VScode。在扩展插件搜索框中找到如下Vetur和VueHelper两个插件,注意看图标。添加Vue模板打...

干货!VsCode接入DeepSeek实现AI编程的5种主流插件详解

AI大模型对编程的影响非常之大,可以说首当其冲,Cursor等对话式编程工具渐渐渗透到开发者的工作中,作为AI编程的明星产品,Cursor虽然好用,但是贵啊,所以咱们得找平替,最好免费那种。俗话说,不...