Visual Studio 2013 New Project Import existing code folder and keep directory structure

Source: Internet
Author: User

This article provides a way to edit existing source code and keep the directory structure in a Windows environment using Visual Studio 2013.

This article uses the VS2013 Chinese Community Edition to do the example (this version is free version, can be downloaded in the VS official website), the other version of the VS operation mode is similar.

    • Open VS2013, choose menu-FILE-new-Create project from existing code

    • Select project Type: Visual C + +

    • Project file location: When created, the sln,suo,vcxproj,filters and user vs solution and project files are generated in this directory, which must be consistent with the root directory of the source code, or the folder structure cannot be imported.
    • Project name fill in the required items
    • Final removal tick "show All Files in Solution Explorer" to avoid too many files

    • Because the code is Linux code and does not need to be compiled under Windows, you can choose to use an external build system to

    • If you don't need to compile, just choose Next

    • Completing the Project Generation Wizard

    • In a project build, if there are more files, it will take some time

    • If the source file originates from a network map disk (for example, the author uses a Linux samba shared disk), a security warning pops up, removing the checkmark and selecting OK.

    • After the project is created, all source files that have been filtered in the project directory will appear in Solution Explorer and are not folders. If you don't see Solution Explorer, you can open it in menu-view.

    • The source file of the folder above is not what we want, if you need to sub-folder, in Solution Explorer, click the "Show All Files" icon, as shown in. After you click, the folder appears. The file icon indicates whether the file belongs to the project file.

    • If the source code path file is updated, such as adding or deleting files, click the Refresh button in Solution Explorer to see the latest file status. If you want to add a new file to the project for administration, right-click on the new file, select "Include In Project", and the file icon will change accordingly.

    • Because the source code is Linux, the Linux header file is inconsistent with the VS default header file, which causes many header files to be missing or mismatched, affecting code hints and reading. The workaround is to add the Linux header file to the include path. Here's how to do it:
    • In Solution Explorer, right-click the project and select Properties.

    • In the pop-up property page, locate the VC + + directory, where the include directory is populated with the header file directory under Linux.

  • about how to get the Linux header file, you can use the Samba server under Linux, connect on Windows, copy the following 3 paths to the appropriate directory for Windows systems, preferably under Linux, copy one under Windows, Otherwise, some files may be overwritten by subsequent copy operations.
    • 1

      2

      3

      Cp-r/usr/include ~/1

      Cp-r/usr/lib/gcc/~/2 #这个目录可能稍有变化, maybe/usr/lib64/gcc.

      Cp-r/usr/local/include ~/3

  • After the copy is complete, paste the following path into VS (64-bit), where "D:\Code\Linux\Ubuntu\" is the root directory for Linux under Windows

    1

    2

    3

    4

    5

    6

    7

    8

    d:\code\linux\ubuntu\usr\include\c++\4.8;

    d:\code\linux\ubuntu\usr\include\x86_64-linux-gnu\c++\4.8;

    D:\code\linux\ubuntu\usr\include\c++\4.8\backward;

    D:\Code\Linux\Ubuntu\usr\lib\gcc\x86_64-linux-gnu\4.8\include;

    D:\Code\Linux\Ubuntu\usr\local\include;

    D:\Code\Linux\Ubuntu\usr\lib\gcc\x86_64-linux-gnu\4.8\include-fixed;

    D:\Code\Linux\Ubuntu\usr\include;

    D:\Code\Linux\Ubuntu\usr\include\x86_64-linux-gnu;

  • Fix VS __cplusplus macro fixed to 199711L to cause unrecognized c++11 new features
    For example, the <unordered_set> header file, which defines the following statement, causes Vs to actually contain a c++0x_warning.h file that does not really recognize the implementation of the Unordered_set:

    1

    2

    3

    #if __cplusplus < 200311L

    # include <bits/c++0x_warning.h>

    #else

    Looking for a long time on the internet, also did not find the method of modifying vs built-in __cplusplus macro, only the curve to the national salvation, will be all the header file 200311L 199711L can be changed, the specific operation is as follows:

    • RePack the header file path under Copy to Windows (for example: D:\Code\Linux\Ubuntu\) after extracting it under Linux:
      Sed-i "s/201103l/199711l/g" ' grep ' 201103L "-rl *"

    • After execution, copy the source files back.
    • After creation, the project files directory generates the following project files, which you will need to open the project directly by double-clicking the sln solution file.

Visual Studio 2013 New Project Import existing code folder and keep directory structure

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.