Home > Operation and Maintenance > Linux Operation and Maintenance > How to write c language in linux

How to write c language in linux

(*-*)浩
Release: 2019-11-08 10:37:59
Original
8333 people have browsed it

How to write c language in linux

1. First determine whether to install the gcc compiler under Linux, directly execute: gcc -v to determine whether to install gcc. (Recommended learning: linux operation and maintenance)

How to write c language in linux

2. Then you need to write a simple C source program in the code box .

How to write c language in linux

#3. The mathematical square root function in C language, sqrt(), is used in the program, so the math.h header file needs to be introduced.

How to write c language in linux

#4. After writing the source program, we compile it. If we use the usual compilation statement, [gcc math.c -o math] to compile, there will be Error; it probably means that you don’t know sqrt.

How to write c language in linux

5. Therefore, needs to use the correct command: [gcc math.c -lm -o math]; only in this way can the compilation be correct.

How to write c language in linux

The above is the detailed content of How to write c language in linux. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template