安徽理工大学:《Linux开发基础 Development Foundation on Linux OS》课程教学资源(PPT课件讲稿)GNU C/C++ programming、CGI programming in GNU C/C++ language(方贤进)

②安薇理工大学 ANHUI UNIVERSITY OF SCIENCE TECHNOLOGY Linux开发基础 Development Foundation on Linux Os 方贤进,PhD& Associate Prof 安徽理工大学计算机科学与工程学院
安徽理工大学 计算机科学与工程学院 Linux开发基础 Development Foundation on Linux OS 方贤进, Ph.D & Associate Prof

⑧安薇理工大学 ANHUI UNIVERSITY OFSCIENCE TECHNOLOG Section 2 GNU C/C++ programming
3 Section 2 GNU C/C++ programming

⑧安薇理工大学 ANHUI UNIVERSITY OFSCIENCE TECHNOLOG hat 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 Pro ject in September 1983 Source: http://www.gnu.org/gnu/initial announcement. htm
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 OFSCIENCE TECHNOLOG 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 a The freedom to run the program, for any purpose(freedom O) a 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 a The freedom to redistribute copies so you can help your neighbor (freedom 2) a 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 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 OFSCIENCE TECHNOLOG hat is gcc? GCC, the GNU Compiler Collection The GNU Compiler Collection includes front ends for C, C+t, 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 Sourcehttp://gcc.gnu.org
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 OFSCIENCE TECHNOLOG 21 GNU C/C++编译器的使用 gc通过扩展名来判断文件的类型,从而确定用何种方式处理该文件 后缀名 说明 C语言源代码文件 C/cxc+源代码文件 h 程序所包含的头文件 已经预处理过的C语言源代码文件 已经预处理过的C++源代码文件 m Objective-C语言源代码文件 ss 汇编语言源代码文件 经过预编译的汇编语言源代码文件 a/。so 编译后的库代码 编译后的目标文件
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通过扩展名来判断文件的类型,从而确定用何种方式处理该文件

⑧安薇理工大学 ANHUI UNIVERSITY OFSCIENCE TECHNOLOG 21 GNU C/C++编译器的使用 gcc编译器选项和参数 参数 含义 -o Place the output into C Compile and assemble, but do not 99 db Produce debugging information for use by GDB O the compiler tries to reduce code size and execution time without performing any optimizations that take a great deal of com-pilaTion Time Produce debugging information in the operating systems native format. GDB can work with this debugging information I Add the directory dir to the list of directories to be searched for header files. Directories named by-i are searched before the L Search the library named library when linking
8 2.1 GNU C/C++编译器的使用 gcc 编译器选项和参数 参数 含义 -o Place the output into -c Compile and assemble, but do not link -ggdb Produce debugging information for use by GDB. -O the compiler tries to reduce code size and execution time, without performing any optimizations that take a great deal of com-pilation time. -g Produce debugging information in the operating system's native format. GDB can work with this debugging information. -I Add the directory dir to the list of directories to be searched for header files. Directories named by -I are searched before the -L Search the library named library when linking

⑧安薇理工大学 ANHUI UNIVERSITY OFSCIENCE TECHNOLOG 21 GNU C/C++编译器的使用 1、直接通过编译生成目标代码可执行文件: Sgcc hello. c -o hello 2、如果一个程序包含有多个源文件,则也可直接生成目标代码: void f10 printf("%sIn","function 1); void f20 printf( %sIn", function 2); maino f10 f20 Sgcc f1.c f2.c main. c -o main
9 2.1 GNU C/C++编译器的使用 1、直接通过编译生成目标代码可执行文件: $gcc hello.c –o hello 2、如果一个程序包含有多个源文件,则也可直接生成目标代码: void f1() { printf(“%s\n”, "function 1"); } void f2() { printf("%s\n", "function 2"); } main() { f1(); f2(); } $gcc f1.c f2.c main.c –o main

⑧安薇理工大学 ANHUI UNIVERSITY OFSCIENCE TECHNOLOG > Linux上广泛使用的C语言编译器是GNUC编译器,GNU c建立在自由软件基金会的编程许可证的基础上,可以自 由发布。在 Linux下,一个完整的c语言开发环境到少包 括以下三个组成部分: √函数库gbc(在/us/ib和/ib目录中) √编译器gcc √系统头文件q! ibc header(h) glibc是构成一个完整的C语言开发环境所必不可少的组成 邗分,也是Lnux下C语言的主要函数库。 glibc_header中包含了系统编译源代码所需要的声明文 件如果缺少系统头文件,很多用到系统功能的c程序将无 法编译。(包含在/usr/ include/及其子目录中) 10
10 ➢ Linux上广泛使用的C语言编译器是GNU C编译器,GNU C建立在自由软件基金会的编程许可证的基础上,可以自 由发布。在Linux下,一个完整的C语言开发环境到少包 括以下三个组成部分: ✓函数库glibc (在/usr/lib和/lib目录中) ✓编译器gcc ✓系统头文件glibc_header (*.h) ➢ glibc是构成一个完整的C语言开发环境所必不可少的组成 部分,也是Linux下C语言的主要函数库。 ➢ glibc_header中包含了系统编译源代码所需要的声明文 件,如果缺少系统头文件,很多用到系统功能的C程序将无 法编译。(包含在/usr/include/及其子目录中)

⑧安薇理工大学 ANHUI UNIVERSITY OFSCIENCE TECHNOLOG 2.2GNUC/C++函数库 定义:是一些预先编译好的函数的集合,那些函数都是按照可再使用 的原则编写的。它们通常是一组相互关联的用来完成某项常见工作的 函数构成(比如c库里面的标准辅入输出函数、时间函数和数学函数 等)。 函数库中的函数可以通过连接程序与应用程序进行连接,而不必在每 次开发程序时都对这些通用的函数进行编译 不同类型的应用程序将会使用不同的函数库。如数学应用将使用数学 库 Elibm(usr/ib/ibma,/usr/ib/ibm.so),标准的C库 libc(usr/ib/ibc.a, /usr/lib/libc. so) 注意:*h只是对函数的声明( declaration),函数的定义是在具体的函 数库中
11 2.2 GNU C/C++函数库 ➢ 定义:是一些预先编译好的函数的集合,那些函数都是按照可再使用 的原则编写的。它们通常是一组相互关联的用来完成某项常见工作的 函数构成(比如c库里面的标准输入输出函数、时间函数和数学函数 等)。 ➢ 函数库中的函数可以通过连接程序与应用程序进行连接,而不必在每 次开发程序时都对这些通用的函数进行编译。 ➢ 不同类型的应用程序将会使用不同的函数库。如数学应用将使用数学 库libm(/usr/lib/libm.a, /usr/lib/libm.so),标准的C库 libc(/usr/lib/libc.a,/usr/lib/libc.so)。 注意:*.h只是对函数的声明(declaration),函数的定义是在具体的函 数库中
按次数下载不扣除下载券;
注册用户24小时内重复下载只扣除一次;
顺序:VIP每日次数-->可用次数-->下载券;
- 《面向对象程序设计》课程教学资源(课件讲稿)C++语言的面向对象特征、Java语言的面向对象特征、Python语言的面向对象特征、R语言的面向对象特征.ppt
- 面向对象程序设计语言(PPT课件讲稿).ppt
- 四川大学:《Linux操作系统》课程教学资源(PPT课件讲稿)第3章 Shell及其编程(主计:潘薇).ppt
- 清华大家:字符串匹配算法(PPT讲稿)String Matching Algorithm(Overview & Analysis).ppt
- Flexsim 初级培训讲义(PPT讲稿)Flexsim Basic Training.ppt
- 《C语言程序设计》课程电子教案(PPT课件讲稿)第2章 数据类型及基本运算量.ppt
- 《软件测试 Software Testing》教学资源(PPT讲稿)Part 2 Testing Fundamentals.ppt
- 《计算机网络安全技术》课程教学资源(PPT课件讲稿)第五章 防火墙技术.ppt
- 《数据库系统概论 An Introduction to Database System》课程教学资源(PPT课件讲稿)第一讲 绪论.ppt
- 《The C++ Programming Language》课程教学资源(PPT课件讲稿)Lecture 01 From C to C++.ppt
- 上海交通大学:《数字图像处理 Digital Image Processing》课程教学资源(PPT课件讲稿,第三版)Chapter 12 Object Recognition.pptx
- 《数据结构》课程教学资源(PPT课件讲稿)第二章 线性表.ppt
- 《C语言程序设计》课程电子教案(PPT课件讲稿)第4章 算法控制结构.ppt
- 沈阳理工大学:《大学计算机基础》课程教学资源(PPT课件讲稿)第3章 编辑排版软件(Microsoft Word 2000).pps
- 《操作系统》课程教学资源(PPT课件讲稿)内存管理 Memory Management.ppt
- 《电子商务概论》课程教学资源(PPT课件讲稿)第一章 电子商务基础知识(主讲:贾朝辉).pptx
- 南京大学:《编译原理》课程教学资源(PPT课件讲稿)第九章 机器无关的优化(赵建华).ppt
- 《计算科学基础研究》课程教学资源(PPT课件讲稿)类的定义.ppt
- 上海交通大学:《程序设计》课程教学资源(PPT课件讲稿)第9章 模块化开发.ppt
- 利用EXCEL进行数据分析与图表处理(PPT讲稿).pptx
- 《Photoshop基础教程与上机指导》课程教学资源(PPT讲稿)第8章 简单编辑图像.ppt
- 中国科学技术大学:《计算机组成原理》课程教学资源(PPT课件讲稿)第五章 虚拟存储器(主讲:李曦).ppt
- 中国科学技术大学:《计算机视觉》课程教学资源(PPT课件讲稿)第七章 基于运动视觉的场景复原.ppt
- 计算机应用基础课程:《信息技术应用基础》教学资源(PPT课件讲稿)第一章 中文WIN98操作系统.ppt
- 山东大学:《微机原理及单片机接口技术》课程教学资源(PPT课件讲稿)第十一章 复位、时钟和省电方式控制.ppt
- 中国科学技术大学:《计算机体系结构》课程教学资源(PPT课件讲稿)第6章 Data-Level Parallelism in Vector, SIMD, and GPU Architectures.ppt
- 北京航空航天大学:《程序语言设计原理》课程教学资源(PPT课件讲稿)并发程序设计语言.ppt
- 北京航空航天大学:《程序语言设计原理》课程教学资源(PPT课件讲稿)第三章 过程式程序设计语言.ppt
- 《微机原理及应用》课程教学资源(PPT课件讲稿)第4章 汇编语言程序设计.pptx
- 清华大学出版社:普通高校本科计算机专业特色教材精选《智能技术》课程教学资源(PPT讲稿课件)第4章 模糊逻辑技术(曹承志).ppt
- 《C++大学教程》课程教学资源(PPT课件讲稿)Chapter 17 文件处理 File Processing.ppt
- 《网站开发》课程教学资源(PPT课件讲稿)网站开发各阶段的任务.ppt
- 《数据结构》课程教学资源(PPT课件讲稿)第十章 文件、外部排序与外部搜索.ppt
- 香港浸会大学:《Data Communications and Networking》课程教学资源(PPT讲稿)Chapter 2 Protocol Architecture - TCP/IP model and OSI Model.ppt
- 南京理工大学:《数据挖掘与处理 Data Mining and Data Processing》课程教学资源(PPT课件讲稿)第一章 数据科学与数据挖掘(张正军).ppt
- 清华大学:A Heterogeneous Accelerator Platform for Multi-subject Voxel-based Brain Network Analysis(PPT讲稿).pptx
- 白城师范学院:《数据库系统概论 An Introduction to Database System》课程教学资源(PPT课件讲稿)第四章 数据库安全性.pptx
- 合肥工业大学:《数据库系统》课程教学资源(PPT课件讲稿)数据库编程 ACCESS、MYSQL、Oracle(张国富)第一章 绪论.ppt
- 《信息安全概论》课程教学资源(PPT课件讲稿)第九章 计算机软件的安全性.ppt
- 清华大学:Pass-Join(A Partition based Method for Similarity Joins).pptx