"Reprint" How to use Visual Studio (VS2010) to compile the C language

Source: Internet
Author: User
Tags win32

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


1. Open VS2010 main interface, then select, file → new → project, select Vc++→win32 in the project type and then select Win32 Console Application in the right template, then enter a name below (project name, no belt.) C
After selecting the save location, make sure that a pop-up dialog box, regardless of it, is next.
2. Next note, this dialog box, the application type to select a console application, the additional option must select "Empty Project." And then the point completes. The dialog box disappears.
3. Back to the VS main interface, there will be more on the left and right side of the Diagram toolbar, "solution Manager", right click on the source file, select "Add → new item". Note here that if you already have a C source file written, select "Existing Item"
4. Also open a dialog box, regardless of the left, in the right side of the template to select C + + file, in the following name of the source file entered the name plus. C, save the location with the default. Then click "Add"
5. Ok, the edit page comes out, you can write code, here is a program for all programmers to write no matter what language is written "Hello World" bar ^_^
As can be seen here, VS2010 can be intelligently labeled function parameters and function body, easy to view and modify. It's much more convenient than VC6.0.
The purpose of Tips:system ("Pause") (the header file windows.h) is to allow the program to "pause" at this location so that the operator can see the result.
Make up, then choose Debugging, or direct point green small arrow button, you can see the program running results, and finally, don't forget to save.

Well, the introduction is over, I believe we have mastered the VS2010 under the C method, so that the VS2010 of the students will not bother to install the VC6.0, vs very good very strong, the other features of our own slowly groping it, hehe, do not say.



Comments:
Note: Now there is basically no pure C-compiler environment, are using C C + + compiler tools to compile C, so the template created is a C + + template. (Everyone must remember VC6.0 in the new file is also C++sourcefile (c + + source file) bar)
Note II: Plus. C, the compiler will know that this is a C source, so that the creation of C source files, compile the time will call the C compiler. And not Add. C, the source file of C + + is created. The compiler for C + + is invoked when compiling. Although C + + compatibility, but in different C + + compilation environment for C support is different, such as the example in this article, the sentence system function is C proprietary, if the use of C + + to compile will be wrong. So, when unsure whether the C + + compiler is supported by some kind of C syntax, remember to add it honestly. C, to tell the compilation system to use the C compiler instead of C + +.
Note Three: Green small arrow means "debugging", shortcut key F5, the use of the time will be the program from the beginning to the end, and then automatically quit, if your program does not suspend the statement, there will be a black program window flashed past the situation.

If you do not want the program to automatically exit after debugging, the easiest way is to select "Debug → start execution" in the menu or press the shortcut key Ctrl+f5.




Reprint URL: http://zhidao.baidu.com/link?url=9vETIFRLl2p4WeaWPyVhx9CJtcFFCyXXhGRc5w2cUYbJFAfQQN--keKfU7aWZA3Zu_ 4zdk1-avq9k02wby00lq


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.