Constitution and installation of C development environment under Linux

Source: Internet
Author: User
Tags crypt

This article describes the Linux C development environment, the composition and installation, so that readers of the Linux C development environment can have a preliminary understanding.

Do you know Linux? Believe now more and more people will say "yes". So how much do you know? There is no denying that most Linux users are currently in the lower level of understanding of Linux, they may be a few commands, with several services, will use RPM to install the software, will operate the kde/gnome, and so on, but when they encounter some need to compile the installation of software, Faced with some simple error messages, they are at a loss. To really jump these primary levels, you won't be able to get to the bottom of things, such as the C development environment under Linux in this article and other operating system knowledge beyond this article.

Linux and C are naturally puzzled by the source, you may know that the Linux operating system kernel is mainly written in C, in addition to a lot of Linux software is written in C, especially some well-known service software, such as MySQL, Apache and so on. Beginners may be compiling software such as MySQL, encountered a variety of errors, in fact, as long as you understand the Linux C development environment, you can choose to solve some of the installation process errors.

Linux's C development environment differs from windows, and in Linux, a complete C development environment consists of the following three components:

1, function library: glibc

To frame a complete C development environment, GLIBC is essential, and it is the main function library of Linux under C. There are two ways to install GLIBC:

A. A function library that is installed as a test when you compile your program, you try a new library B with different options. Installed as the main C function library all new compilers use a library of functions

GLIBC2 includes several additional packages: Linuxthreads, Locale, and crypt, usually with different versions of the file names, similar to the following file names:

glibc-2.06.tar.gz glibc-linuxthreads-2.0.6.tar.gz glibc-localedate-2.0.6.tar.gz glibc-crypt-2.0.6.tar.gz

2. Compiler: GCC

GCC (GNU Ccompiler) is the powerful, superior performance of the multiplatform compiler, the GCC compiler can be C, C + + language source program, and the target program compiled, connected to the executable file, the following is the GCC supported the compilation of some source files suffix and its interpretation:

. c is a suffix of the file, C language source code files;. A is a suffix file, which is a file of archives composed of the target file;. c,.cc or. cxx is the suffix of the file, is a C + + source code file;. h is the suffix of the file, the program contains the header file;. I is the suffix of the file, is already preprocessed C source code files;. II is the suffix of the file, is a preprocessed C + + source code file;. m is the suffix of the file, is Objective-c source code file;. o is the suffix file, is the compiled object file;. s is the suffix of the file, is the assembly language source code file;. S is the suffix of the file, is precompiled assembly language source code files.

3. System header File: Glibc_header

If the system header file is missing, many C programs that use system functionality will not compile.

If the user in the installation process less installed these packages, you will not be able to compile the C source program. Beginners sometimes choose their own customized packages to install, the result of the omission of these packets, resulting in the inability to compile the source program, many people have to reinstall Linux. There is no need to do this, although the C development environment from the TAR pack to install Linux is more difficult for beginners, but we can use the RPM package to quickly install the Linux C development environment. The following example, Red Hat 7.3, describes how to install the Linux C development environment, and if it is a newer version of Red Hat, you can also refer to it, only to notice the different versions of the software.

Since the GCC package relies on binutils and CPP packages, and the make package is also commonly used in compilation, a total of 8 packages are required to complete the installation, which are:

cpp-2.96-110.i386.rpm binutils-2.11.93.0.2-11.i386.rpm glibc-2.2.5-34.i386.rpm glibc-kernheaders-2.4-7.14.i386.rpm glibc-common-2.2.5-34 glibc-devel-2.2.5-34.i386.rpm gcc-2.96-110.i386.rpm make -3.79.1-8.i386.rpm

If you are connected to the Internet, you can install directly from the Internet, as follows:

RPM-IVH ftp://216.254.0.38/linux/redhat/7.3/en/os/i386/RedHat/RPMS/cpp-2.96-110.i386.rpm

RPM-IVH ftp://216.254.0.38/linux/redhat/7.3/en/os/i386/RedHat/RPMS/binutils-2.11.93.0.2-11.i386.rpm

RPM-IVH ftp://216.254.0.38/linux/redhat/7.3/en/os/i386/RedHat/RPMS/glibc-kernheaders-2.4-7.14.i386.rpm

RPM-IVH ftp://216.254.0.38/linux/redhat/7.3/en/os/i386/RedHat/RPMS/glibc-2.2.5-34.i386.rpm

RPM-IVH ftp://216.254.0.38/linux/redhat/7.3/en/os/i386/RedHat/RPMS/glibc-devel-2.2.5-34.i386.rpm

RPM-IVH ftp://216.254.0.38/linux/redhat/7.3/en/os/i386/RedHat/RPMS/glibc-common-2.2.5-34.i386.rpm

RPM-IVH ftp://216.254.0.38/linux/redhat/7.3/en/os/i386/RedHat/RPMS/gcc-2.96-110.i386.rpm

RPM-IVH ftp://216.254.0.38/linux/redhat/7.3/en/os/i386/RedHat/RPMS/make-3.79.1-8.i386.rpm

If it's not connected to the Internet, download it and install it. After installation, it constitutes the most basic C development environment, in this c development environment, you can compile the majority of C-written applications. And for a C program, the installation can usually be divided into three components:

1. executable file 2. contains file 3. library files

The executable file is the last command to run, including some definition files included in the C program, and the library file is a custom library for that C program. For example, the MySQL installed with RPM: executable files placed under/usr/bin, include files under/usr/include/mysql, library files under/usr/lib/mysql. The program executable can run correctly only if the system can find the program's corresponding included files and library files.

Understanding the Linux development environment of the formation and installation, or not enough, but also to its in-depth research and learning, to be able to do "know it, know why".

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.