Developer on Alibaba Coud: Build your first app with APIs, SDKs, and tutorials on the Alibaba Cloud. Read more ＞
The composition and installation of the C development environment in Linux-general Linux technology-Linux programming and kernel information. The following is a detailed description. This article introduces the composition and installation of the Linux C development environment, so that readers can have a preliminary understanding of the Linux C development environment.
Do you know about Linux? I believe that more and more people will say "yes. To what extent do you know? It is undeniable that most Linux users are still at a relatively low level of understanding about Linux, they may execute several commands, configure several services, use rpm to install software, operate the KDE/Gnome interface, and so on. But when they encounter software that needs to be compiled and installed, in the face of some simple error information, they are helpless. If you really want to jump to these basic levels, you will not be able to understand some underlying things, such as the C development environment in Linux and other operating system knowledge in this article.
Linux and C are born with an unknown source. You may know that the Linux operating system kernel is mainly written in C, and many software in Linux is written in C, especially some well-known service software, such as MySQL and Apache. Beginners may encounter various errors when compiling software such as MySQL. In fact, as long as you have a preliminary understanding of the Linux C development environment, you can choose to solve some errors during the installation process.
The C development environment in Linux is different from that in Windows. In Linux, a complete C development environment consists of the following three components:
1. function library: glibc
To build a complete C development environment, Glibc is essential. It is the main function library of C in Linux. Glibc has two installation methods:
A. Install the function library for testing
Use different options to test the new function library during program compilation.
B. Install it as the main C function library
Function libraries used by all newly compiled programs
Glibc2 contains several additional packages: LinuxThreads, locale, and crypt. Generally, their file names vary with versions and are similar to the following file names:
Gcc (GNU CCompiler) is a GNU multi-platform compiler with powerful functions and superior performance, the gcc compiler can compile and connect the C and C ++ language source programs, programming sequences, and target programs into executable files. The suffixes and explanations of some source files supported by gcc are as follows:
. C is a suffix file, c language source code file;
. A is a file with a suffix. It is a file library consisting of the target file;
. C,. cc or. cxx is a C ++ source code file;
. H is a suffix file, which is the header file included by the program;
. I is a file with a suffix. It is a pre-processed C source code file;
. Ii is a file with a suffix. It is a pre-processed C ++ source code file;
. M is a suffix file, which is an Objective-C source code file;
The. o file is the compiled target file;
. S is a suffix file, which is an assembly language source code file;
. S is a precompiled assembly language source code file.
3. System header file: glibc_header
If the system header file is missing, many C Programs that use system functions cannot be compiled.
If the user installs less packages during the installation process, the C source program cannot be compiled. Beginners sometimes choose their own customized software packages for installation. As a result, these packages are missing, and the source program cannot be compiled. Many people have to reinstall Linux. In fact, this is not necessary. Although it is difficult for beginners to install the Linux C development environment from the tar package, we can still install the Linux C development environment quickly through the rpm package. The following uses Red Hat 7.3 as an example to describe how to install the C development environment of Linux. For a later version of Red Hat, you can refer to it, but pay attention to the different software versions.
The gcc package depends on binutils and cpp packages, and make packages are also commonly used in compilation. Therefore, a total of 8 packages are required for installation. They are:
If it is not connected to the internet, download and install it. After installation, the most basic C development environment is formed. In this C development environment, you can compile most applications written in C. For a C program, after the installation is complete, it can be divided into three components:
1. executable files
2. Include files
3. library files
The executable file is the final run command. The include file is some definition files of the C program include, and the library file is the custom library of the C program. For example, for MySQL installed with RPM: the executable files are stored in/usr/bin, including files in/usr/include/mysql, and the library files are stored in/usr/lib/mysql. Only the system can find the files and library files corresponding to the program, and the executable files of the program can run normally.
It is not enough to understand the composition and installation of the C development environment of Linux. You still need to study and study it in order to "know it, know it ".
This article is an English version of an article which is originally in the Chinese language on aliyun.com and is provided for information purposes only. This website makes no representation or warranty of any kind, either expressed or implied, as to the accuracy, completeness ownership or
reliability of the article or any translations thereof. If you have any concerns or complaints relating to the article, please send an email, providing a detailed description of the concern or
complaint, to firstname.lastname@example.org. A staff member will contact you within 5 working days. Once verified, infringing content will be removed immediately.
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:
and provide relevant evidence. A staff member will contact you within 5 working days.