The Visual C + + 2010 Getting Started Tutorial series one: Things about Visual Studio, VC, and C + +

Source: Internet
Author: User
Tags win32 visual studio 2010



Date: 2010.6.15

Write in front

While I was still in school, I chose C + +, originally I used VC6 as my IDE, I have read a lot of C + + textbooks, some suitable for me, some not suitable for me, including a book called "Visual C + + 2005 Primer Classic" To help me a lot of busy. Because the usual C + + textbooks will only introduce the syntax of C + +, very little will tell us how to compile, run, tell us what is the console program, what the win program, what is the GUI program, C + + can do, VC and C + + what is the difference. Now there are a lot of friends should have these problems?

C + + with C + + also has a few years, not familiar, is the first glimpse of the gateway, I think I should do something to help those who have been as confused as my friends, especially students friends, tell them the answer to their confused questions. Remember when I learn C + +, no one teaches, sometimes also go a lot of detours, and even debugging will not, also do not know can see call stack see Call order, but also their own slowly to search, good silly ah.

Next I'm going to do a "Visual C + + 2010 Getting Started Tutorial" series to help beginners. It was very painful when I first started to learn, and I have a lot of experience in this, especially when I have no one to guide one or two. The content mainly covers common content developed under Windows using C + +, the use of Visual Studio 2010, how to create a new project, how to debug it, if you configure the project properties, and so on, also introduces some new additions to Visual C + + 2010, Includes some new STL builds, some new syntax support, and so on.

Because my level is limited, there are inevitably errors, I hope you understand, if you have found the problem also please be sure to point out in time, or mislead others I am not guilty of sin.

Note that this tutorial is not a C + + tutorial and will not teach you C + +, but will teach you how to use Visual C + + 2010 to Practice Learning other C + + textbook programs. Therefore, we recommend that you take a serious look at other C + + tutorials, when using Visual C + + 2010 practice, if you encounter problems can be referred to here. Recommended "C + + Primer", "C + + programming language", "Visual C + + 2008 Getting Started classic".

The first chapter about Visual Studio, VC, and C + +

Chapter II installation, configuration and first-time use of VS2010

This chapter will help you install Visual C + + 2010, help you do some common configuration, and use it for the first time to write Helloword programs.


Visual C + + 2010 is part of Visual Studio 2010, as explained in the previous chapter, in fact Visual C + + 2010 also has more sub-versions, just as Windows7 has the ultimate, home Premium, and home starter editions. In the previous chapter there are two versions to choose from, I choose the time of the flagship edition, this feature is most comprehensive.

If you have downloaded, there should be an ISO image file, if you downloaded from the address I gave, then the serial number has been replaced with the original serial number, directly installed. Here is the ISO file:

This is the disc image file, we have a number of ways to install it, you can burn it into a CD-ROM, you can also install it with the virtual CD-ROM software, because this ISO has been modified, you can even unzip it, and then run the Setup.exe inside to install.

Here I use the virtual optical drive to illustrate, first I assume you have installed the virtual optical drive software daemon Tools Lite, if you have not installed, please go to the Ranger patch network download, because there you always find the latest free version.

Next we load the ISO image that we just downloaded via the virtual CD:

In the dialog box that pops up, select the ISO file that we downloaded. At this time, the virtual CD-ROM has opened the ISO file for us, some machines may automatically eject the installation prompt, and some will not. If the installation prompt automatically eject, then directly through, if not pop-up, then use the Explorer mode to enter the virtual optical drive Click Setup.exe to start the installation.

Since I have installed the VS2010, so I can not give everyone, I will directly in the text description it.

When the pop-up VS2010 installer points to the next step, and then we may see the full minimum customization of such options, I recommend that you choose Custom, because only then can we customize our installed directory. Next, you will select the installed components. This time we will see a lot of VS2010 components, here we can choose whether to install basic C # and so on, I found some pictures on the internet, although the Chinese version of 2010 is not the same, we probably look the same, we will make a look at it.

Below is the starting interface, we should choose to install VS2010.

Above this time choose agree. The installation package will then start collecting information:

Select directory:

Then you start the installation, and note that you may need to reboot one or two times during installation.

Final installation success:


When the installation is successful, we can start to use, here I first teach you to do some common configuration, of course, you can also directly with the default settings, I am so configured mainly for convenience.

Start VS2010 with the Start menu below:

If you are the first to start, then may let you choose the default environment settings, we want to use VC of course choose VC Configuration:

The following screen shows that it has been successfully installed and running. This is the start page and you will see it often later.

Note that you may not have vassistx this menu, because this is an external tool that will explain its usefulness later, and now ignore it for the time being. Next, let's do some common settings. With the menu Tools option to bring up the configuration dialog box, here are some common settings:

Mediation line number, select the text editor, all languages, the line number tick.

If you want to adjust the font or color, then you can choose here:

Click on the blank area of the toolbar and let's get the build toolbar out:

This way we can choose to compile the project, compile the entire solution, run the program and debug the program directly above the toolbar. Select the small triangle next to the build toolbar to customize, and we can add some buttons:

Click the Add button below the custom interface to add a new button, and now let's add the toolbar to start (not debug):

I used to be asked why my program flashed, because they took the debug (F5, the solid triangle) as a run (no debugging, Ctrl+f5, hollow with the tail of the triangle). Of course it was a flash. About debugging later said.


Below let us use VC + + 2010 is VC10 to do a console HelloWorld program bar.

VC2010 cannot compile a single. cpp or a. c file, these files must be dependent on one project, so we must create a project. There are many ways to create a project that can be created by menu: file, new, project, or by clicking New Item from the toolbar. Here we click on the new item above the start page:

Click to enter the New Project Wizard:

Select the Win32 console application above, enter the name of the HelloWorld point to determine whether to create a directory for the solution for the time being, the main difference is whether the solution is in the same directory as the project file.

Next, go to the Create page and click the next step on the first page of the Win32 Application Wizard:

Next page Remember to choose an empty project, we do not need precompiled header:

Click Done.

At this time an empty project compiles successfully, we may as well compile some to try. Click the Generate button for the build toolbar you just added:

At this time we will encounter a compilation error, why? Because we do not have the main function, for a C + + project, there must be one and only one main function (Windows programs need to WinMain, the difference is later), can be implicitly provided or can be explicitly provided, as for the difference will be discussed later. Now let us remember this error, when we encounter this error, we must think about whether there is a main function in our project. Note that this is meaningless even if you are supporting a file with a main function to compile in VC10 because that file is not part of our project.

Now we can add a code file to come in, this code file can be already existing or can be new, create a new one here. Right-click the project name, select Add, new item:

In the wizard, select Code, C + + file (. cpp), name enter Main, OK.

At this time has successfully added a main file, note that when adding a new file to prevent duplicate name:

Then we enter the simplest few lines of code, then compile it, and compile the same method as above.

If the compilation is successful you will see the above screen, if the failure will be error prompts, then you can follow the prompts to modify the project configuration or code. Then let's run it with the ctrl+f5 or dot that hollow triangle:

OK, next you can change the program to practice the C + + textbook above the program.

So much for this chapter, we'll discuss the following in the next chapter: what is C + +? What is programming and so on.

The Visual C + + 2010 Getting Started Tutorial series one: Things about Visual Studio, VC, and C + +

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: 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.