C Programming in Linux

Source: Internet
Author: User
Linux C Programming attempts-general Linux technology-Linux programming and kernel information. The following is a detailed description. Recently, to program in C language in linux, I installed n or more Linux systems, such as redhat, fedora, and ubuntu. There is also the red-flag linux that I sent when buying a computer. It seems that I have used a lot of linux systems.

I think it is better to install a virtual machine on a Linux system. We can use vmware to install a virtual machine so that Windows and linux systems can be used at the same time. For example, we can use Windows to download some files, then you can easily put it on Linux. Besides, at the beginning, you cannot be as familiar with Linux as you are familiar with Windows. Isn't it? When we are skilled in using Linux, we don't need a virtual machine. Of course, if you want to play games, you only have Windows, because all the games in Linux are pediatrics and cannot play large games. It is better to play online games or Warcraft games. Also, if dual-system is installed, we recommend that you install ubuntu Linux, because the system is installed in the same way as a software under Windows, and if you uninstall it, you only need to unmount the Add/delete program in Windows. Is it very convenient. In addition, its interface is quite beautiful, and even fedora8 imitates it.

Okay. If you talk so much nonsense, start programming. In linux, I use the gedit text editor to write programs. First, I typed the following program according to some tutorials:

Main ()

{

Printf ("Hello, Linux! ");

}

Save it as hello. c. Note that there must be. c. If there is no, it is not a c program.

Then compile in the terminal and switch to hello. run the gcc hello. c-o hello, is to put hello. c is compiled into an executable file named hello, but a warning will be prompted during compilation: the printf function is not an embedded function or something. In short, there is a warning. At the beginning, I thought I had not installed the glibc library. I didn't understand it all day long. Later, we can see that the Hello. c directory already has a hello executable file, so we run the./hello command. The result is displayed on the terminal Hello. Linux! . Alas, no matter what, the result is finally displayed. But what should I do with warnings?

Anyone who wants to learn C language knows that if I want to use the printf function, I should include stdio. h In the program. So I changed the above program:

# Include "stdio. h"

Main ()

{

Printf ("Hello, Linux! \ N ");

}

Then compile with gcc again, without warning. I am so happy to die.

In this way, we can understand the basic C programming language in Linux. However, if there are many header files, makefile will be used in. h. You can find some tutorials. I will not talk about it here.
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.