1. Operating system
Windows operating systems: Windows 7 and Windows 10
2. Development tools and compilation tools
Development tools: notpad++ and Vim
Compilation tool: Cygwin64 Terminal
3. Tool installation
1) Download notpad++ and Cygwin64 Terminal directly in Baidu
2) refer to the online installation method for Cygwin64 terminal, install vim and GCC
To see if the installation of Vim and GCC was successful:
$ gcc--version
GCC (GCC) 4.9.3
Copyright? Free Software Foundation, Inc.
This procedure is free software; Please refer to the copyright notice of the source code. The software does not have any warranties;
Includes no warranties of merchantability and fitness for a particular purpose.
$ vim--version
Vim-vi Improved 7.4 (compiled OCT 8 2015 00:46:23)
Includes patches: 1-801, 803-808, 810-891
Compiled by <[email protected]>
4.Hello World
The Linux C language and other C languages write Hello World in the same way that the code looks like:
| 1234567 |
#include<stdio.h>int main(void){ printf("Hello World!!"); return0;} |
With the introduction of the Stdio header file, you can call the printf function to print something to the terminal.
5. Compiling and Running
Compiling is simple, using the GCC compiler that was previously installed to:
[Email protected]/cygdrive/e/c_study/helloworld
$ gcc Main.c-o Hello
Description
1) You can view the parameter description of the compilation tool via GCC--help
2) After GCC need to connect source source code, can contain multiple files
3)-O followed by the target file, which is the final executable file
After compiling, this directory tree looks like this:
$ ls
Hello.exe MAIN.C
The target file is an. exe suffix because of the use of Windows system development
Operation Result:
$./hello.exe
Hello world!!
The output is the familiar Hello World, the content printed through printf.
Summarize:
The above initial completion of the Linux C language development environment to build, compile and execute the necessary preparations, the following start learning Linux C language from scratch.
Build a Linux C language development environment