Differences between visual C ++ projects and solutions, visual Solutions

Source: Internet
Author: User
Tags wxwidgets

Differences between visual C ++ projects and solutions, visual Solutions

Project:

A project is a container that forms all components of a program. The program may be a console program, a window-based program, or some other program. A program usually consists of one or more source files containing user code, and may also contain files containing other auxiliary data. All files of a project are stored in the corresponding project folder.Project details are stored in an xml file with the extension. vcproj, which is also stored in the corresponding project folder.The project folder also contains other folders, which are used to store the output generated when the project is compiled and linked.

Solution:

As the name suggests, a solution means a mechanism that aggregates all programs and other resources (they are a solution to a specific data processing problem. For example, a distributed order entry system for enterprise operation may consist of several different programs, and each program is developed as a project in the same solution. Therefore, A solution is a folder that stores all information related to one or more projects, so that one or more project folders are subfolders of the solution folder.Project-related information in the solution is stored in two files with the extension. sln and. suo.If you do not select to add a project to an existing solution when creating a project, the system automatically creates a new solution.

When creating a project and a solution, you can add more projects to the same solution. We can add any type of projects to an existing solution, but usually only add projects related to existing projects in the solution. Generally, each project should have its own solution unless we have a good reason not to do so.

When a project is created in VS2010, the default project folder name is the same as the project name. This folder also contains files that constitute the project definition. If not modified, the solution folder has the same name as the project folder, which contains the project folder and the file that defines the solution content. The solution folder contains the following four files:

 

  • Files with the extension. sln,Records Information about items in the solution.
  • File with the extension. suo, whereRecord the user options applied to the solution.
  • Files with the extension. sdf record data related to the solution's intelliisense. Intelliisense is a tool that provides the Automatic completion and prompt functions when entering code in the Editor window.
  • File with the extension. opensdf,Records information about the project status. This file is only available when the project is open.
The readme.txt file in the project folder contains a summary of all the files created for the project. Files created during project creation:After the project is built, a new sub-Folder Debug appears in the solution folder. This folder contains the output generated when the project was just built. This folder contains three files.
  • . Exe file: Executable File
  • . Ilk file: this file is used by the chain adapter when a new project is created. It enables the chain adapter to connect the target file generated by the source code to the existing. EXE file, so that all files are relinked every time the program is modified.
  • . Pdb file: Contains debugging information, which must be used for execution of programs in debugging mode. In debugging mode, you can dynamically check information generated during program execution.
There is also a Debug directory in the project folder, which contains many files generated during the build process. You can see what information they contain in the Type description of Windows Explorer. What is the ipch folder and. sdf file?Ipch folder, and a project with the same name. the sdf file, and the files under ipch and. the sdf files are large. These files are used by Visual Studio to save pre-compiled header files and intelliisense. Deleting these files has no impact on project development. What if I want to use pre-compiled header files and intelliisense, and do not want to see these boring files?

Tool-> Option-> Text Editor-> C/C ++-> advanced-> rollback location where both are set to true

If you set the rollback location, IPCH will be there, otherwise there will be a VC ++ folder in the system TEMP.

 

Another explanation of the VS2010 solution and project file:

Divide all files into six parts: solution-related files, project-related files, application header files and source files, resource files, pre-compiled header files, and compiled links to generate files.

1. solution files

Solution files include the. sdf file,. sln file,. suo file, and ipch folder in the solution folder.

The. sdf file and ipch directory usually occupy a large space of dozens or even hundreds of megabytes. They are related to smart prompts, error prompts, code recovery, and local team repository. If you do not need them, you can choose not to generate them by clicking Tools> Options in the menu bar. The Options dialog box is displayed, select Text Editor-> C/C ++-> Advanced in the left-side Navigation Pane. Change the first Disable Database in the right-side list from False to True. Close VS2010 and delete it. the sdf file and the ipch directory will no longer be generated. However, disabling this option will cause a lot of inconvenience. For example, when writing a program, the smart prompt is gone.

The. sln file and. suo file are automatically generated solution files by MFC. They contain engineering information in the current solution and storage solution settings.

2. engineering documents

Project-related files include the. vcxproj file and. vcxproj. filters file in the project folder.

The. vcxproj file is a project file generated by MFC. It contains the settings of the current project and the files contained in the project .. The vcxproj. filters file stores the project's virtual directory information, that is, the directory structure information in the solution browser.

3. Application header files and source files

The Application Wizard automatically generates header files and source files based on the application type (single document, multi-document, or dialog box-based program). These files are the main part of the project, it is used to implement the main framework, documents, views, and so on.

Below are a brief introduction of each file: http://hovertree.com/menu/cpp/

HelloWorld. h: The main header file of the application. It mainly includes the declaration of the CHelloWorldApp class derived from the CWinAppEx class and the declaration of the Global Object theApp of the CHelloWorldApp class.

HelloWorld. cpp: main source file of the application. It mainly includes the implementation of the CHelloWorldApp class and the definition of the Global Object theApp of the CHelloWorldApp class.

MainFrm. h and MainFrm. cpp: use these two files to derive the CMainFrame class from the CFrameWndEx class, which is used to create the main frame, menu bar, toolbar, and status bar.

HelloWorldDoc. h and HelloWorldDoc. cpp: These two files are derived from the CDocument class CHelloWorldDoc, which contains some member functions for initializing documents, serializing (saving and loading) documents, and debugging.

HelloWorldView. h and HelloWorldView. cpp: they derive from the CView Class A View class known as CHelloWorldView for displaying and printing document data, including some plotting and debugging member functions.

ClassView. h and ClassView. cpp: The CClassView Class is derived from the CDockablePane Class to implement the Class View on the left panel of the application interface.

FileView. h and FileView. cpp: The CFileView class is derived from the CDockablePane class to implement the File View on the left panel of the application interface.

OutputWnd. h and OutputWnd. cpp: The COutputWnd class derived from the CDockablePane class is used to implement the Output on the lower panel of the application interface.

PropertiesWnd. h and PropertiesWnd. cpp: The CDockablePane class is derived from the CDockablePane class to implement the Properties on the right panel of the application interface.

ViewTree. h and ViewTree. cpp: The CViewTree class derived from the CTreeCtrl class is used to implement tree views that appear in ClassView and FileView.

4. Resource file

Generally, the window program generated using MFC has resources such as the dialog box, icon, and menu. The Application Wizard generates Resource-related files: res directory, HelloWorld. rc file, and Resource. h file.

Res Directory: The res directory in the project folder contains the default icons of applications, and icons used in the toolbar.

HelloWorld. rc: contains the default menu definition, string table, and acceleration key table. It specifies the default About dialog box and the default application icon file.

Resource. h: ID definition of various resources.

5. Pre-compile the header file

Almost all MFC program files must contain files such as afxwin. h. If each compilation is required, compilation will be greatly slowed down. Therefore, the common MFC header files are stored in stdafx. in the H file, and then stdafx. cpp contains stdafx. h file, compiler for stdafx. cpp is compiled only once and the pre-compiled header HelloWorld is generated. pch greatly improves compilation efficiency.

6. Compile the link to generate a file

If it is compiled in Debug mode, a Debug sub-folder is generated in both the solution folder and project folder. If it is compiled in Release mode, a Release sub-folder is generated.

The Debug or Release subfolders in the project folder contain intermediate files generated during the compilation link, the Debug or Release subfolders in the solution folder mainly contain executable files of applications.

Let's talk about the composition structure of the application project file first. It contains many special terms and will be familiar to you later.

 

 

 

What is C ++ learning?

C ++ is a very complex language. To implement simple tasks in other languages, C ++ usually requires a lot of code and time, for example, creating a window, other languages have built-in support, which cannot be achieved in pure C ++ environments. C ++ does not provide built-in GUI support. If you want to create a window using C ++, you need to use system APIs or use libraries that encapsulate system APIs, the former is like a Win32 system API, and the latter is like MFC and wxWidgets.

However, this does not mean that C ++ is not good, but C ++ is very powerful. We learn C ++ not just the C ++ syntax, what is the use of C ++ syntax? Demonstrate algorithms? Of course not. In my opinion, C ++ is familiar with C ++ syntax at the early stage. In the middle stage, it is a general design method that learns STL libraries, system APIs, and C ++ object-oriented ideas, the latter is a lifetime of your C ++ career because it has no end point.

In addition to deepening your understanding of C ++, you need a variety of Libraries Based on C ++ to implement more specific things. If you want to make a GUI, you have to learn QT, wxWidgets, and so on. If you want to play games, you need to learn Ogre, Unreal, Bigworld and other libraries. Network Database ASIO, RakNet, and ACE. These libraries are all based on C ++, which encapsulates the underlying APIs. Similarly, we don't have to use complicated APIs every time to implement the functions we want. Of course, you can also use C ++ to encapsulate these APIs, so that you can become a library author for the convenience of others.

Recommended: http://www.cnblogs.com/roucheng/p/cppjy.html

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.