In the new beginning, I learned C language programming in linux-general Linux technology-Linux programming and kernel information. The following is a detailed description. Here we will introduce some basic knowledge of C/C ++ programming on Linux/UNIX machines.
· Background knowledge required
· Basic Development Environment
· Ways to get help
· Learn the basic steps through an instance
Prerequisite prerequisites:
To write C Programs on Linux, you must be familiar with the following basic knowledge:
1. C language programming basics, at least need to know some basic syntax, control flow and other programming knowledge.
Have a common understanding of common standard C function libraries.
2. Familiar with Linux/UNIX operations, Master common shell commands, such as ls, cat, cp, mkdir... Etc.
Environment required by Environment:
1. For Linux/Unix operating systems, you can also use cygwin in windows.
We will discuss all the operations through shell command lines. What should I do if I enter Linux with a graphic interface? As long as you open a terminal command, it is exactly the same as the command line environment (you can find the terminal command when you open the Start Menu ).
2. required development tools:
1) The input program requires an editor. Commonly used methods include vi and emacs. Input vi, emacs,… on the command line ,... You can enter the editing Environment
About vi
About EMACS
2) C language compiler. Commonly used are the gnu c language compiler gcc (compiling C Programs) and g ++ (compiling C ++ programs ).
About gcc/g ++
About makefile >>>> used to simplify the compilation process
Here is an entry-level article about C Programming in Linux.
3) common tool for program debugging: gdb.
About gdb
Get help for help:
Linux documentation is very rich. It's the quickest and most convenient. You can store all the information on your machine. Don't waste it.
On the command line, enter the shell command man or info:
$ Man gcc >>>> this command can obtain the gnu c language compiler documentation. Of course, they are in English.
About man
Info
There are also a lot of resources on the network, so that you do not know what is your most needed. How to obtain valuable information
Take a look at the related resources on loveunix >>>
Basic steps:
1. Input Source Code
2. Compile, link, and run
3. debug the program
Let's start with the basic hello world Program and perform the following operations:
1. Input Source Code