Ubuntukylin Basics using GCC compile a C language HelloWorld program precompiled compile Link

Source: Internet
Author: User

Town Yard text:
The Confucian School of the practical and practical, line Buddhism Purdue sentient beings, the monastic Kangsheng fidelity, understanding of the easy to change the image. To science and technology to shine a good law, the achievement of a conscience blog.
______________________________________________________________________________________________________

My system: Ubuntukylin 16.04 LTS 64bit


STEP0:

View the current folder

650) this.width=650; "src=" Https://s3.51cto.com/wyfs02/M00/8D/FA/wKioL1iybj6CsaWBAAB1FUs5YHA624.png "title=" 1.png "alt=" Wkiol1iybj6csawbaab1fus5yha624.png "/>


Step1:

Create a C language source code file with the VIM editor

650) this.width=650; "src=" Https://s3.51cto.com/wyfs02/M01/8D/FC/wKiom1iybovzyFVSAAB3AKdtcfI940.png "title=" 2.png "alt=" Wkiom1iybovzyfvsaab3akdtcfi940.png "/>


Step2:

Write a C program that can print the HelloWorld function at the terminal

650) this.width=650; "src=" Https://s2.51cto.com/wyfs02/M02/8D/FC/wKiom1iybsixaNV-AABRwRhxisQ382.png "title=" 3.png "alt=" Wkiom1iybsixanv-aabrwrhxisq382.png "/>


Step3: Pre-compilation

Code

Tip

1 I was using-O to set the output of the result file name is MYCODE.E

650) this.width=650; "src=" Https://s5.51cto.com/wyfs02/M02/8D/FC/wKiom1iybwrjyiMCAABsSzDQ30I743.png "style=" float : none; "title=" 2017-02-22 01-36-07 screen. png "alt=" Wkiom1iybwrjyimcaabsszdq30i743.png "/>

The content in the MYCODE.E file is:

650) this.width=650; "src=" Https://s2.51cto.com/wyfs02/M02/8D/FA/wKioL1iybwugQqHHAADDRTH3r5E842.png "style=" float : none; "title=" 2017-02-22 01-36-54 screen. png "alt=" Wkiol1iybwugqqhhaaddrth3r5e842.png "/>



STEP4: Compilation

Code

Tip

Note Case, Ss. Ann can distinguish me is size? O (∩_∩) o~

650) this.width=650; "src=" Https://s5.51cto.com/wyfs02/M01/8D/FC/wKiom1iyb4agBXunAABv1dPeqxs702.png "title=" 2017-02-22 01-39-32 screen. png "alt=" Wkiom1iyb4agbxunaabv1dpeqxs702.png "/>

File Show:

650) this.width=650; "src=" Https://s5.51cto.com/wyfs02/M01/8D/FA/wKioL1iyb7_yaz04AAD6ihzo0ss357.png "title=" 2017-02-22 01-39-53 screen. png "alt=" Wkiol1iyb7_yaz04aad6ihzo0ss357.png "/>



STEP5: Compiling

Code

650) this.width=650; "src=" Https://s5.51cto.com/wyfs02/M02/8D/FC/wKiom1iycAag6u9gAAB8_DxdjBw811.png "style=" float : none; "title=" 2017-02-22 01-43-13 screen. png "alt=" Wkiom1iycaag6u9gaab8_dxdjbw811.png "/>


File Show:

The contents of the file generated by the compile command are this way:

650) this.width=650; "src=" Https://s4.51cto.com/wyfs02/M00/8D/FA/wKioL1iycAfSDOCDAADtSOBzwuI348.png "style=" float : none; "title=" 2017-02-22 01-43-49 screen. png "alt=" Wkiol1iycafsdocdaadtsobzwui348.png "/>


The file command looks at the types of MYCODE.O files:

650) this.width=650; "src=" Https://s5.51cto.com/wyfs02/M02/8D/FA/wKioL1iycAjQsDwSAABPab9an4c400.png "style=" float : none; "title=" 2017-02-22 01-44-14 screen. png "alt=" Wkiol1iycajqsdwsaabpab9an4c400.png "/>



STEP6: Links

The C language library (so file) is packaged with the target file to generate an executable program

650) this.width=650; "src=" Https://s4.51cto.com/wyfs02/M01/8D/FC/wKiom1iycLDyudtjAAB8icT2LV0537.png "title=" 2017-02-22 01-48-01 screen. png "alt=" Wkiom1iycldyudtjaab8ict2lv0537.png "/>


STEP7: Run a gcc-linked executable file


But when I run into this exception, I can't find the command.

650) this.width=650; "src=" Https://s4.51cto.com/wyfs02/M00/8D/FC/wKiom1iycSvR99E7AACNHyXq7Q4726.png "style=" float : none; "title=" 2017-02-22 01-49-41 screen. png "alt=" Wkiom1iycsvr99e7aacnhyxq7q4726.png "/>


That's what I'm dealing with.

650) this.width=650; "src=" Https://s1.51cto.com/wyfs02/M01/8D/FA/wKioL1iycSvg77fsAAA0XTnCJDE902.png "style=" float : none; "title=" 2017-02-22 02-17-13 screen. png "alt=" Wkiol1iycsvg77fsaaa0xtncjde902.png "/>

. Current working directory



Comprehensive:

The following example is a small successful attempt:

Code Show:

650) this.width=650; "src=" Https://s1.51cto.com/wyfs02/M01/8D/FA/wKioL1iycgDw6d70AABTH8E3hw8969.png "style=" float : none; "title=" 2017-02-26 00-57-27 screen. png "alt=" Wkiol1iycgdw6d70aabth8e3hw8969.png "/>


Command show:

650) this.width=650; "src=" Https://s3.51cto.com/wyfs02/M02/8D/FA/wKioL1iycgLCxqqRAAICtTJ5G6U142.png "style=" float : none; "title=" 2017-02-26 00-59-09 screen. png "alt=" Wkiol1iycglcxqqraaicttj5g6u142.png "/>


after the test is completed, make a good record, delete the file with RM, restore the scene.

650) this.width=650; "src=" Https://s5.51cto.com/wyfs02/M00/8D/FC/wKiom1iycgOBu00yAAAh_1Iz8_8474.png "style=" float : none; "title=" 2017-02-26 01-00-32 screen. png "alt=" Wkiom1iycgobu00yaaah_1iz8_8474.png "/>




______________________________________________________________________________________________________
If you think this blog post has a place to improve, please comment, I will think carefully.
Note: This blog post is only used for scientific research, if the infringement of your interests, please inform me, I will make the appropriate treatment.




This article is from the "calm mind like water, chi just like the pan." Blog, be sure to keep this source http://xinjingzhigang.blog.51cto.com/12262830/1901363

Ubuntukylin Basics using GCC compile a C language HelloWorld program precompiled compile Link

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.