How to compile the C language using Visual Studio (VS2008)

Source: Internet
Author: User

Everyone is learning c The language is usually in contact with vc6.0 compile only Span style= "Font-family:times New Roman;" >c c++ , c# The integration is not very high. And the interface is not very friendly, can not automatically guess the keyword, function parameters can not be automatically marked. The most important thing is that when compiling the error correction information is all in English, it is very inconvenient for beginners. In the demo compile some simple c program vc6.0 Yes, but for a slightly more complex program editing work, vc6.0 a little overwhelmed.

1. Open VS2008 main interface, file → new → project , select in Project type vc++→win32 then select the Win32 console application in the right-hand template and enter a name below (the project name, without the belt .) C) Choose Save , pop up a dialog box, whatever it is, next .

2.next note, in this dialog box, the application type to select the console application, the additional options must be selected"Empty Project". then click Finish. Then the dialog box disappears. 3.Back toVSThe main interface, this will be on the left and right more toolbars"Solution Manager",Right click on the source file and select"Add→New Item". Note here, if you have already written wellCsource file, then select"Existing Item"

4. Open a dialog box , regardless of the left, select the C + + file (note one) in the template on the right, and enter the name of the source file Plus in the name below . C(Note II), save the location with the default. Then click " add "

5. OK, edit the page came out, you can write code, here to write all programmers no matter what language to write a program "Hello World" bar ^_^



Tips:The purpose ofsystem("Pause") is to " pause "when the program executes to this location

Made up, and then choose to debug, or directly point the Green Small arrow button (note three) you can see the program running results , and Finally, do not forget to save .

Here I putprintfsemicolon after a function statement";"removed, and then separately inVC6.0and theVS2008compile it and see what happens.,this isVC6.0tips, Pure English, for students with poor English level is confused,this isVS2008Pure Chinese is clear,only from this point,VS2008is more thanVC6.0it's more convenient.

Well, the introduction is over, I believe everyone also mastered the VS2008 under the method of compiling C , so installed VS2008 students will not have to bother to install VC6.0 out, VS Very good very strong, the other functions of everyone's own slowly groping it, hehe, do not say.

Comments:

Note: Now there is basically no pure C - compiler environment, are compiled with C + + compiler tool to compile C, So the template created is a C + + template. (You must remember that VC6.0 in the new file is also c++sourcefile(C + + source file).

Note two: add. C, the compilation system will know that this isCsource, creating aCsource file, which will be called when compilingCcompiler. Without adding. C, the creation isC + +the source file. is called when compiling.C + +the compiler. AlthoughC + +compatibleC, but in a differentC + +the compilation EnvironmentCthe support is different, like the example in this article, the sentencesystemfunction isCProprietary, if adoptedC + +to compile it will make an error. So, in the uncertain use of theC + +does the compiler support some kind ofCGrammar, or honestly remember to add. Cto tell the compilation system to useCcompiler instead ofC + +.

Note Three: The green small arrow means " debug ", shortcut key F5, use when the program will be executed from the beginning to the end, and then automatically exit, if your program does not pause the statement, A Black program window will appear flashing through the situation. If you do not want the program to automatically exit after debugging, the easiest way is to choose " debug → start execution " in the menu or press the shortcut key Ctrl+f5

How to compile the C language using Visual Studio (VS2008)

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.