GCC中文使用手册:Linux/C++编程必备

5星 · 超过95%的资源 需积分: 50 30 下载量 179 浏览量 更新于2024-10-16 收藏 554KB PDF 举报
"Linux/Ubuntu gcc中文使用手册.pdf" GCC,全称GNU Compiler Collection,是GNU项目中的一个关键组件,用于编译C、C++、Objective-C、Fortran、Ada以及Go等多种编程语言的源代码。它是一个强大的前端编译器,支持多种目标平台和操作系统,包括Linux和Ubuntu。这个手册提供了GCC的中文使用指南,便于中文用户理解和掌握GCC的使用方法。 **总览(SYNOPSIS)** GCC的命令行使用通常包括选项和源文件。基本的使用形式是`gcc`或`g++`,后面跟着一系列的选项(option)和源文件名。例如: ```bash gcc [option] [filename] g++ [option] [filename] ``` **警告(WARNING)** 手册提醒用户,这个中文手册页可能不是最新的,可能只包含部分选项的解释,且不保证与软件的最新版本完全同步。遇到不一致的情况,应参考Info文件,它是GCC的权威文档来源。 **描述(DESCRIPTION)** GCC是GNU工程的一部分,它不仅是一个编译器,还包括了预处理器、汇编器和链接器等工具,可以处理从源代码到可执行程序的整个过程。它支持多语言编程,并且可以针对不同的硬件平台进行编译。 **选项(OPTIONS)** 选项用于控制GCC的行为,例如设置优化级别、开启或关闭特定警告、指定输出文件、链接库等。这些选项包括: 1. **总体选项(Overall Option)**:如`-v`显示编译过程的详细信息。 2. **语言选项(LANGUAGE OPTIONS)**:如`-std=c++11`指定C++11标准。 3. **预处理器选项(Preprocessor Options)**:如`-Dmacro`定义宏。 4. **汇编器选项(ASSEMBLER OPTIONS)**:如`-S`生成汇编代码。 5. **连接器选项(LINKER OPTIONS)**:如`-lmylib`链接名为`mylib`的库。 6. **目录选项(DIRECTORY OPTIONS)**:如`-I`添加头文件搜索路径。 7. **警告选项(WARNING OPTIONS)**:如`-Wall`开启所有警告。 8. **调试选项(DEBUGGING OPTIONS)**:如`-g`生成调试信息。 9. **优化选项(OPTIMIZATION OPTIONS)**:如`-O2`启用二级优化。 10. **目标机选项(TARGET OPTIONS)**:用于指定目标架构。 11. **机器相关选项(MACHINE DEPENDENT OPTIONS)**:针对特定硬件的配置。 12. **代码生成选项(CODE GENERATION OPTIONS)**:如`-fPIC`生成位置无关代码。 **PRAGMAS** Pragma是预处理器指令,允许在源代码中插入特定编译器的指令,以影响编译行为。 **文件(FILE)** GCC处理的文件可以是源代码文件、头文件、对象文件或库文件。 **另见(SEE ALSO)** 可能提到的其他相关文档,如Info文件`gcc`和`Using and Porting GNU CC`。 **BUGS** 报告GCC的bug或问题,通常应遵循GNU项目的bug报告指南。 **版权(COPYING)** GCC遵循GNU General Public License(GPL),意味着它是自由软件,用户有权查看、修改和分发源代码。 **作者(AUTHORS)** GCC是由众多贡献者共同开发的,包括原始作者和后续的维护者。 GCC中文手册是学习和使用GCC编译器的重要参考资料,涵盖了从基础使用到高级特性的广泛内容,对于开发者来说是非常有价值的。

make for plat=atlas310 cross=aarch64-ascend310-linux-gnu- LDFLAGS=-Wl,--gc-sections -static -L/home/257916/server/test/v1.1/Trunk/build/../src/thirdpart/libs/atlas310 -L/home/257916/server/test/v1.1/Trunk/build/../lib/atlas310 -ldw -lbs -lpthread -lm EXTRA_CFLAGS=-DSVN_VERSION="\"64670"\" -I /net -DOSA_MODULE_NAME=Spectrum-Convert@64670 -DBUILD_DATE="\"Mon, 24 Jul 2023 19:48:54 +0800"\" CFLAGS=-D_GNU_SOURCE -I/home/257916/server/test/v1.1/Trunk/build/../include -I/home/257916/server/test/v1.1/Trunk/build/../src/base/include -I/home/257916/server/test/v1.1/Trunk/build/../src/base/test/include -I/home/257916/server/test/v1.1/Trunk/build/../src/decode/include -I/home/257916/server/test/v1.1/Trunk/build/../src/decode/test/include -I/home/257916/server/test/v1.1/Trunk/build/../src/fourier/include -I/home/257916/server/test/v1.1/Trunk/build/../src/fourier/test/include -I/home/257916/server/test/v1.1/Trunk/build/../src/include -I/home/257916/server/test/v1.1/Trunk/build/../src/service/include -I/home/257916/server/test/v1.1/Trunk/build/../src/service/test/include -I/home/257916/server/test/v1.1/Trunk/build/../src/draw/include -I/home/257916/server/test/v1.1/Trunk/build/../src/draw/test/include -I/home/257916/server/test/v1.1/Trunk/build/../tools/include -fPIC -ffunction-sections -fdata-sections -g -Wall -O1 -c -o ############################################################ mkdir -p /home/257916/server/test/v1.1/Trunk/build/../bin/atlas310 aarch64-ascend310-linux-gnu-g++ -o draw test/src/draw_pic_test.o -Wl,--gc-sections -static -L/home/257916/server/test/v1.1/Trunk/build/../src/thirdpart/libs/atlas310 -L/home/257916/server/test/v1.1/Trunk/build/../lib/atlas310 -ldw -lbs -lpthread -lm /opt/Atlas310-ascend/toolkit/toolchain/hcc/bin/../lib64/gcc/aarch64-target-linux-gnu/7.3.0/../../../../aarch64-target-linux-gnu/bin/ld: test/src/draw_pic_test.o: Relocations in generic ELF (EM: 62) /opt/Atlas310-ascend/toolkit/toolchain/hcc/bin/../lib64/gcc/aarch64-target-linux-gnu/7.3.0/../../../../aarch64-target-linux-gnu/bin/ld: test/src/draw_pic_test.o: Relocations in generic ELF (EM: 62) /opt/Atlas310-ascend/toolkit/toolchain/hcc/bin/../lib64/gcc/aarch64-target-linux-gnu/7.3.0/../../../../aarch64-target-linux-gnu/bin/ld: test/src/draw_pic_test.o: Relocations in generic ELF (EM: 62) /opt/Atlas310-ascend/toolkit/toolchain/hcc/bin/../lib64/gcc/aarch64-target-linux-gnu/7.3.0/../../../../aarch64-target-linux-gnu/bin/ld: test/src/draw_pic_test.o: Relocations in generic ELF (EM: 62) /opt/Atlas310-ascend/toolkit/toolchain/hcc/bin/../lib64/gcc/aarch64-target-linux-gnu/7.3.0/../../../../aarch64-target-linux-gnu/bin/ld: test/src/draw_pic_test.o: Relocations in generic ELF (EM: 62) /opt/Atlas310-ascend/toolkit/toolchain/hcc/bin/../lib64/gcc/aarch64-target-linux-gnu/7.3.0/../../../../aarch64-target-linux-gnu/bin/ld: test/src/draw_pic_test.o: Relocations in generic ELF (EM: 62) /opt/Atlas310-ascend/toolkit/toolchain/hcc/bin/../lib64/gcc/aarch64-target-linux-gnu/7.3.0/../../../../aarch64-target-linux-gnu/bin/ld: test/src/draw_pic_test.o: Relocations in generic ELF (EM: 62) /opt/Atlas310-ascend/toolkit/toolchain/hcc/bin/../lib64/gcc/aarch64-target-linux-gnu/7.3.0/../../../../aarch64-target-linux-gnu/bin/ld: test/src/draw_pic_test.o: Relocations in generic ELF (EM: 62) /opt/Atlas310-ascend/toolkit/toolchain/hcc/bin/../lib64/gcc/aarch64-target-linux-gnu/7.3.0/../../../../aarch64-target-linux-gnu/bin/ld: test/src/draw_pic_test.o: error adding symbols: file in wrong format collect2: error: ld returned 1 exit status make[1]: *** [draw] Error 1 make[1]: Leaving directory `/home/257916/server/test/v1.1/Trunk/src/draw' make: *** [draw] Error 2

2023-07-25 上传