- 论坛徽章:
- 0
|
Linux下C语言编程环境的搭建
要想在Linux下进行C语言编程,首先得搭建好一个编程环境。这里分别说明一下几个非常有用的软件包。
如果你对Linux下软件安装方法还不清楚,请参考文章“Linux下软件安装方法总结”http://zhoulifa.bokee.com/5444771.html
1、gcc
要进行C语言编程,首先得有个C语言的编译器,Linux下常用的是GNU C Compiler gcc。软件包的信息如下:
Package: gcc
Priority: optional
Section: devel
Installed-Size: 64
Maintainer: Ubuntu Core Developers
Original-Maintainer: Debian GCC Maintainers
Architecture: i386
Source: gcc-defaults (1.41ubuntu3)
Version: 4:4.1.1-6ubuntu3
Provides: c-compiler
Depends: cpp (>= 4:4.1.1-6ubuntu3), gcc-4.1 (>= 4.1.1-2)
Recommends: libc6-dev | libc-dev
Suggests: make, manpages-dev, autoconf, automake1.9, libtool, flex, bison, gdb, gcc-doc
Conflicts: gcc-doc (= 2.16.1cvs20051214), libgcc1 (>= 1:4.1.1-13ubuntu5), libc6 (>= 2.4-1)
Recommends: libc6-dev (>= 2.3.6-7), libmudflap0-dev (>= 4.1.1-13ubuntu5)
Suggests: gcc-4.1-doc (>= 4.1.1), gcc-4.1-locales (>= 4.1.1), libc6-dev-amd64, lib64gcc1 (>= 1:4.1.1-13ubuntu5)
Conflicts: gcj-4.1 (= 4.1.1-2)
Suggests: cpp-doc
Conflicts: cpp-doc (= 2.4-1)
Suggests: gcc-4.1-locales (>= 4.1.1)
Conflicts: gcj-4.1 (= 2.4-1)
Filename: pool/main/g/gcc-4.1/libgcc1_4.1.1-13ubuntu5_i386.deb
Size: 21404
MD5sum: 879959bc964403be55aa096a8bb269f9
SHA1: 3a3cfd824e25a2ce9008d98da1269f5ffdb7507f
SHA256: 62f3f64daaa1dd19fc76d966718184d1e0e0ee9f733f7f955b8b09e27b69a7d1
Description: GCC support library
Shared version of the support library, a library of internal subroutines
that GCC uses to overcome shortcomings of particular machines, or
special needs for some languages.
Bugs: mailto:ubuntu-users@lists.ubuntu.com
Origin: Ubuntu
Task: minimal
6、libc6
C语言程序要能够运行,需要一些运行时库文件和一些库文件操作命令。libc6这个软件包就是用来提供这些的。这个软件包几乎是Linux系统自带的,因为所有C程序的运行都离不开此软件包。软件包信息如下:
Package: libc6
Priority: required
Section: base
Installed-Size: 9992
Maintainer: Ubuntu Core Developers
Original-Maintainer: GNU Libc Maintainers
Architecture: i386
Source: glibc
Version: 2.4-1ubuntu12.3
Replaces: ldso (= 2.3.11)
Suggests: locales, glibc-doc
Conflicts: strace (= 2.4-1)
Suggests: binutils-doc (= 2.17-1ubuntu1)
Conflicts: gas, elf-binutils, modutils (= 2.4), tzdata
Conflicts: belocs-locale-data, base-config
Filename: pool/main/l/langpack-locales/locales_2.3.22_all.deb
Size: 3023314
MD5sum: bfc03e46a01addb754b9ea03979c3458
SHA1: 219943450cf30851870b89cabe766da04b4cdff3
SHA256: fe9345e58e70db1c8c6e798f40a07d988f2d4c5de4408e9c8ac3db87d99fbe24
Description: common files for locale support
This package provides support for localized environments (locales).
It installs character and transliteration maps, provides the POSIX
locale definition and provides common scripts for language pack
handling.
.
The actual locale definitions are not part of this package, these are
shipped in the language packs and are installed and removed
automatically.
Bugs: mailto:ubuntu-users@lists.ubuntu.com
Origin: Ubuntu
Task: minimal
虽然上面列了这么多必需的软件包,但实际上因为他们之间有依赖关系,所以在安装完系统后我们只需要输入下面一个命令:
apt-get install gcc
系统就会自动帮忙把这些软件包安装上。
/************关于本文档********************************************
*filename: 我是这样学习Linux下C语言编程的-Linux下C语言编程环境的搭建
*purpose: 列出Linux下C语言编程者必备的几个软件包
*wrote by: zhoulifa(zhoulifa@163.com) 周立发(http://zhoulifa.bokee.com)
Linux爱好者 Linux知识传播者 SOHO族 开发者 最擅长C语言
*date time:2007-02-09 18:20
*Note: 任何人可以任意复制代码并运用这些文档,当然包括你的商业用途
* 但请遵循GPL
*Thanks to:Ubuntu
*Hope:希望越来越多的人贡献自己的力量,为科学技术发展出力
* 科技站在巨人的肩膀上进步更快!感谢有开源前辈的贡献!
*********************************************************************/
9、libc6-dev
我们要进行软件开发,必然需要一些库文件和头文件,在Linux常用的就是GNU的C语言库libc,要安装开发工具必须安装这个libc6-dev软件包,信息如下:
Package: libc6-dev
Priority: optional
Section: libdevel
Installed-Size: 7872
Maintainer: Ubuntu Core Developers
Original-Maintainer: GNU Libc Maintainers
Architecture: i386
Source: glibc
Version: 2.4-1ubuntu12.3
Replaces: man-db (= 2.4-1)
Suggests: make-doc-non-dfsg
Filename: pool/main/m/make-dfsg/make_3.81-2_i386.deb
Size: 148054
MD5sum: 818d9b86d322629e5f218e8a101157c9
SHA1: b5a04fd649b418b689c4918f17b5d94d01b11c5d
SHA256: 6dc9467599278802a34c2a7ee9125a7f4b42719fcc8fdab8124bde7db80c5328
Description: The GNU version of the “make” utility.
GNU Make is a program that determines which pieces of a large
program need to be recompiled and issues the commands to recompile
them, when necessary. More information about GNU Make can be found in
the `make’ Info page. The upstream sources for this package are
available at the location ftp://ftp.gnu.org/gnu/make/. The
documentation for this package does not meet the Debian Free Software
Guidelines, and has been removed From this package.
Bugs: mailto:ubuntu-users@lists.ubuntu.com
Origin: Ubuntu
Task: ubuntu-desktop, kubuntu-desktop, xubuntu-desktop
14、make-doc
要运行make工具,先得学会怎么用它吧?看这个软件包提供的文档就行了。此软件包信息如下:
Package: make-doc
Priority: optional
Section: doc
Installed-Size: 1884
Maintainer: Manoj Srivastava
Architecture: all
Source: make-doc-non-dfsg
Version: 3.81-3
Replaces: make (= 2.4-1), libncurses5 (>= 5.4-5), libreadline5 (>= 5.1)
Suggests: gdb-doc
Conflicts: gdb-arm
Filename: pool/main/g/gdb/gdb_6.4.90.dfsg-1ubuntu3_i386.deb
Size: 2371532
MD5sum: c3483bd4246e5a15e1a940d4b907c45e
SHA1: 986b32bde241bef04e3e61a3fbe74e16f32b526a
SHA256: 69adcb23c8be1e0a50bb59f916a32a7da90836b02e08d2ca84e8ae63fad2fc01
Description: The GNU Debugger
GDB is a source-level debugger, capable of breaking programs at
any specific line, displaying variable values, and determining
Where errors occurred. Currently, it works for C, C++, Fortran,
Modula 2 and Java programs. A must-have for any serious
programmer.
Bugs: mailto:ubuntu-users@lists.ubuntu.com
Origin: Ubuntu
Task: ubuntu-desktop, kubuntu-desktop, edubuntu-desktop
16、gdb-doc
有了上面的gdb程序调试工具了,怎么学会使用它呢?安装这个软件包gdb-doc,即gdb的文档,此软件包信息如下:
Package: gdb-doc
Priority: optional
Section: devel
Installed-Size: 564
Maintainer: Daniel Jacobowitz
Architecture: all
Version: 6.4.90-1
Replaces: gdb (
本文来自ChinaUnix博客,如果查看原文请点:http://blog.chinaunix.net/u2/63043/showart_722752.html |
|