Take you to the visual studio--to take you to a new project

Source: Internet
Author: User

And then I'm going to take you to the next article. Visual studio--begins by introducing the topic, and now we start by creating a new project. Create a project step-by -Step Select menu: File\new\project, open the New Project dialog box. <1> Select project type: Win32 Console application;<2> Fill in the Project name: TestProject (You can give it an arbitrary name you want); <3>. Select the path to store the project: D:\CppWorkspace.

Figure 1:new Project

You might want to ask: what is the meaning of so many project types in the list? This question is discussed later, you should remember this picture first.

Click OK, then click Next, and this step appears

Figure 2:application Settings

We will use the default settings, click Finish, Project creation completed.
(This is the project-related settings, the same first do not care about it, first remember this picture, discussed later). Engineering Structure and catalogue structure Engineering Structure


Figure 3: Engineering structure

Once the creation is complete, we will see an engineering structure on the left. The following are described separately:
External dependencies:
The external dependency file for the project, which is vs automatically generated, you'd better not move it.

Header Files:
header file, which is the header file for the. h (. hpp) suffix.

Source Files:
source files, as well as. cpp (or. c, for the C language) suffix file.

Header Files:
Resource file, if you create an MFC project, the *.rc file will be here. the role of engineering structure: Convenient management, the different types of documents and different uses of different structures, convenient file browsing, search and code management. The directory of the engineering structure is not necessarily the same as the directory of the real file. You can reconfigure the engineering structure according to the different uses or meanings of the file.
For example, I think the source files and header files This is too long, you can select it to press F2, respectively, it renamed to Source and header. For a custom configuration of the engineering structure, the following chapters will be mentioned again. directory Structure


Figure 4: Directory structure

As mentioned above, "The directory of the engineering structure is not necessarily the same as the directory of the real file", we open the directory where TestProject is located in the File manager, we can see that *.h and *.cpp files are in the same directory, in my directory is located in D:\CppWorkspace\ Testproject\testproject. Write a HelloWorld program

All the computer language learning starts from the HelloWorld, Ok, then we also started to write a program from HelloWorld. Write a HelloWorld program in the TestProject.cpp file as follows:

#include "stdafx.h"

#include <iostream>

using namespace std;

int _tmain (int argc, _tchar* argv[])
{
    cout << "Hello World" << Endl;
    return 0;
}

Compile:
Right-click the project name TestProject Select Build, or click menu Build\build Project.

Run:
The content is too simple, run it directly, press CTRL+F5 or click the menu Debug\start without debugging.

Figure 5: Program Run results

The meaning of the documents under the engineering catalogue

Most of the articles may be introduced to the top even if it's over, but I don't have it yet. Create the various files generated by the project you know what it is.

If you are a beginner, you may not know (veteran please skip this article). OK, I'll take you through it. Solutions and Engineering

Before that, understand a concept: solutions and engineering.
solution (Solution): The overall working environment for a large project;
Project (Project): a sub-project under a solution;

In VS, a solution can have one or more project. When we create a project, if we do not specify SOLUTION,VS will help us create a solution with the same project name, when there is only one project in a solution. All in our TestProject file directory Structure TestProject folder also has a TestProject folder (Figure 4), the first is the entire solution directory, the second is the Directory of project. solution-related files:

TestProject.sln:
The entire solution (Solution) is a compounding file that organizes multiple projects and related elements into a solution. Double-click it to open the entire project with VS.

TESTPROJECT.SDF:
Browse the relevant database files, which support browsing and navigation features. For example, jump to the declaration of a method, a variable, find all the referenced places of all objects, Class View, and so on.

Testproject.suo:
(Solution user Opertion) Solution users option that records all the options that will be associated with the solution so that it contains your customizations each time it is opened.

TESTPROJECT.OPENSDF:
When you open a solution (Solution), a temporary file that only has your solution in the VS open state will be deleted when the project closes the file. Project-related documents

testproject.vcxproj:
Records Engineering (project)-related property compounding.

TestProject.vcxproj.filters:
File filters, the organization and choreography of the various files in the "Engineering structure" above in Figure 3 are defined in this file. 100% is the reason for this file if the organizational structure of the file is chaotic when you open the project for a particular reason (such as a system or VS-sudden crash).

TestProject.vcxproj.user:
Some of the user-related configuration.

Some of the more important documents in the above files that must not be deleted are:
TestProject.sln, Testproject.vcxproj, TestProject.vcxproj.filters

Don't ask me how I know the effect of these documents, please read the official documents:
VS2010 definition: https://msdn.microsoft.com/en-us/library/3awe4781.aspx.
VS2015 definition: Https://msdn.microsoft.com/en-us/library/vstudio/hx0cxhaw (v=vs.110). aspx

Of course, there are some explanations that need to be understood through project practice.

Previous review:
I'll show you around. Visual studio--opening Introduction

What to tell in the next article:
take you to play the visual studio--take you know VC + + various types of engineering

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.