安藏理工大学 ANHUI UNIVERSITY OF SCIENCE TECHNOLOGY Section 2 GNU C/C++programming 3
3 Section 2 GNU C/C++ programming
安藏理工大学 ANHUI UNIVERSITY OF SCIENCE TECHNOLOGY What is GNU? The GNU operating system is a complete free software system,upward-compatible with Unix.GNU stands for "GNU's Not Unix".Richard Stallman made the Initial Announcement of the GNU Project in September 1983. Source: http://www.gnu.org/gnu/initial- announcement.html 4
4 What is GNU? ➢ The GNU operating system is a complete free software system, upward-compatible with Unix. GNU stands for “GNU's Not Unix”. Richard Stallman made the Initial Announcement of the GNU Project in September 1983. Source: http://www.gnu.org/gnu/initialannouncement.html
安藏理工大学 ANHUI UNIVERSITY OF SCIENCE TECHNOLOGY What is Free Software? > "Free software"is a matter of liberty,not price.To understand the concept,you should think of "free"as in "free speech",not as in "free beer". > Free software is a matter of the users'freedom to run,copy, distribute,study,change and improve the software.More precisely, it refers to four kinds of freedom,for the users of the software: The freedom to run the program,for any purpose (freedom O). The freedom to study how the program works,and adapt it to your needs(freedom 1).Access to the source code is a precondition for this. The freedom to redistribute copies so you can help your neighbor (freedom 2). ▣ The freedom to improve the program,and release your improvements to the public,so that the whole community benefits (freedom 3).Access to the source code is a precondition for this. 5
5 What is Free Software? ➢ “Free software” is a matter of liberty, not price. To understand the concept, you should think of “free” as in “free speech”, not as in “free beer”. ➢ Free software is a matter of the users' freedom to run, copy, distribute, study, change and improve the software. More precisely, it refers to four kinds of freedom, for the users of the software: The freedom to run the program, for any purpose (freedom 0). The freedom to study how the program works, and adapt it to your needs (freedom 1). Access to the source code is a precondition for this. The freedom to redistribute copies so you can help your neighbor (freedom 2). The freedom to improve the program, and release your improvements to the public, so that the whole community benefits (freedom 3). Access to the source code is a precondition for this
安藏理工大学 ANHUI UNIVERSITY OF SCIENCE TECHNOLOGY What is gcc? >GCC,the GNU Compiler Collection. >The GNU Compiler Collection includes front ends for C,C++,Objective-C,Fortran,Java, and Ada,as well as libraries for these languages (libstdc++,libgcj,...).GCC was originally written as the compiler for the GNU operating system.The GNU system was developed to be 100%free software,free in the sense that it respects the user's freedom. Source:http://gcc.gnu.org 6
6 What is gcc? ➢ GCC, the GNU Compiler Collection. ➢ The GNU Compiler Collection includes front ends for C, C++, Objective-C, Fortran, Java, and Ada, as well as libraries for these languages (libstdc++, libgcj,...). GCC was originally written as the compiler for the GNU operating system. The GNU system was developed to be 100% free software, free in the sense that it respects the user's freedom. Source: http://gcc.gnu.org
安藏理工大学 ANHUI UNIVERSITY OF SCIENCE TECHNOLOGY 2.1GNUC/C++编译器的使用 gcc通过扩展名来判断文件的类型,从而确定用何种方式处理该文件 后缀名 说明 .c C语言源代码文件 .C/.cc/.cxx C++源代码文件 .h 程序所包含的头文件 i 已经预处理过的C语言源代码文件 .ii 已经预处理过的C++源代码文件 .m Objective-C语言源代码文件 .S 汇编语言源代码文件 .S 经过预编译的汇编语言源代码文件 .a/.so 编译后的库代码 .0 编译后的目标文件
7 后缀名 说明 .c C语言源代码文件 .C/.cc/.cxx C++源代码文件 .h 程序所包含的头文件 .i 已经预处理过的C语言源代码文件 .ii 已经预处理过的C++源代码文件 .m Objective-C语言源代码文件 .s 汇编语言源代码文件 .S 经过预编译的汇编语言源代码文件 .a/.so 编译后的库代码 .o 编译后的目标文件 2.1 GNU C/C++编译器的使用 gcc通过扩展名来判断文件的类型,从而确定用何种方式处理该文件