Dark Horse programmer-ios Learning-C language Primer-non-MAC compilation C Environment, algorithm understanding-01

Source: Internet
Author: User

Very happy to write the first technical blog! I haven't written a blog since 2011! All right, nonsense! Following body

iOS Development course has C language, then, we currently do not buy Mac computer, then we have installed virtual machine, using Windows and Linux to Practice C Language bar, can buffer a few days, can do the basic test, you can use!

vc++6.0 installation, Baidu Search, vc++6.0, and then download down, install, it's so simple! I install it in my virtual machine!

650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M01/4B/BD/wKioL1QxloOzyosSAAXazr3mIOY272.jpg "title=" b5.png "alt=" Wkiol1qxloozyossaaxazr3mioy272.jpg "/>

Click Setup.exe, pop up a program compatible prompt box, ignore, click Run, anyway, encounter next, on the point, encountered continue on the point, just fine, install software simple, plus I was to practice C language, hint, I do not look, rude on the installation of


Open, write down our first C language Program! Since then, we have all learned to write C language!

Here's a note: To create a new file, you need to choose C++source files, why, this is the C + + compiler, but C + + compatible C can run, the file suffix is CPP (c plus plus) is not C.

650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M02/4B/BD/wKioL1Qxj6GwGr99AAMgNahNAIY087.jpg "title=" Bb1.png "alt=" Wkiol1qxj6gwgr99aamgnahnaiy087.jpg "/>

Finished, we started compiling, linking, and executing,

650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M01/4B/BD/wKioL1Qxkw6jbbahAAPxdLpwhFg561.jpg "title=" p2.png "alt=" Wkiol1qxkw6jbbahaapxdlpwhfg561.jpg "/>

After compiling, if there is no problem, the bottom display, 0error,0waring

If, the Terminator semicolon behind the printf function is removed, then the display 1ERROR,0WARING,VC will also remind you of what went wrong, then, in the case of errors, the link is not executed, give the same hint 1error,0waring

650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M00/4B/BD/wKioL1QxlNyStfWDAARnlVKQnZc511.jpg "title=" b3.png "alt=" Wkiol1qxlnystfwdaarnlvkqnzc511.jpg "/>

Then put the number Plus, continue the link, all the way green, link, and then execute, of course you can not link directly click Execute, will automatically link, then execute, run the generated. exe file

650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M00/4B/BB/wKiom1QxldDTwx-SAAJqxQn-scY465.jpg "title=" b4.png "alt=" Wkiom1qxlddtwx-saajqxqn-scy465.jpg "/>

So let's simply look at the Linux C environment build:

Actually very simple, if it is centos,redhat with yum,yum-y install gcc if it is Debian and Ubuntu with Apt-get,apt-get install GCC
, look at the system, file version.

If you like to build a step-by-step installation, that's OK, like I'm installing the CentOS5.5 virtual machine! He has this installation disk in the GCC installation file, mount the installation disk, found under the CentOS, and then, install time Ah, directly with RPM will be a problem, will prompt you package of dependencies, and then, You can do it at the end.

650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M01/4B/BB/wKiom1Qxnn6zLRLCAANNZ5gbJqU412.jpg "style=" float: none; "title=" B6.png "alt=" Wkiom1qxnn6zlrlcaannz5gbjqu412.jpg "/>

650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M02/4B/BD/wKioL1QxnrPTS7A7AAMWCwQAuVM139.jpg "style=" float: none; "title=" B7.png "alt=" Wkiol1qxnrpts7a7aamwcwqauvm139.jpg "/>
650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M02/4B/BB/wKiom1QxnoHTRmwMAARjGL50w5U712.jpg "style=" float: none; "title=" B8.png "alt=" Wkiom1qxnohtrmwmaarjgl50w5u712.jpg "/>

Installing GCC
RPM-IVH kernel-headers-2.6.18-194.el5.i386.rpm
RPM-IVH glibc-headers-2.5-49.i386.rpm
RPM-IVH glibc-devel-2.5-49.i386.rpm
RPM-IVH libgomp-4.4.0-6.el5.i386.rpm
RPM-IVH gcc-4.1.2-48.el5.i386.rpm

After the installation is successful, we use the command line to write down the first C program!

The same as the teacher in the video, we also use touch to create, Mac OS itself is UNIX-like system, Linux is Unix-like system, then the instructions are the same

Touch NIHAOHEIMA.C//Oops, no Chinese, I am Linux big Rookie, regardless, direct pinyin

Use Vim to edit, without that Vi,vi no highlighting, vim NIHAOHEIMA.C

650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M00/4B/BD/wKioL1QxocbwgE4AAAETpJZb2nk684.jpg "title=" b9.png "alt=" Wkiol1qxocbwge4aaaetpjzb2nk684.jpg "/>

GCC nihaoheima.c and then generate the A.out file, you are not very familiar with it, with our Mac feel like it, Mac is using CC

650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M01/4B/BB/wKiom1QxoWqwNXOmAAFQsVzZt8c828.jpg "style=" float: none; "title=" B10.png "alt=" Wkiom1qxowqwnxomaafqsvzzt8c828.jpg "/>


This article is from the "Ten Years" blog, please be sure to keep this source http://yanshinian.blog.51cto.com/8275527/1560776

Dark Horse programmer-ios Learning-C language Primer-non-MAC compilation C Environment, algorithm understanding-01

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.