Use Visual Studio 2017 as a Linux C ++ development tool, Visual

Source: Internet
Author: User
Tags linux mint

Use Visual Studio 2017 as a Linux C ++ development tool, Visual

Visual Studio 2017

Microsoft universe first IDE Visual Studio 2017 official version out, address is: https://www.visualstudio.com/vs/whatsnew/

VS2017 has many highlights, including modular installation, faster startup (faster than 50% for the first time), github plug-in, improved startup pages, and enhanced code prompting functions. For more information, see https://www.visualstudio.com/en-us/news/releasenotes/vs2017.

Visual Studio 2017 Support for Linux Development

VS2017 can edit, compile, and debug c ++, python, and node. js programs on linux (detailed ).

You can even compile and debug the. NET program. The supported Linux platforms include:

CentOS 7.1 and Oracle Linux 7.1

Debian 8

Fedora 23

Linux Mint 17

OpenSUSE 13.2

Red Hat Enterprise Linux 7.2

Ubuntu 14.04 and 16.04

The blogger mainly uses c ++ as the development language, and most of the Code has cross-platform requirements. The main steps are as follows:

Use visual studio on windows machines to develop most algorithm function modules and complete debugging and optimization. When I/O or network-related components are involved, port them to the linux platform and use vim to write code, gcc compilation and gdb debugging.

Focus on the highlights of Visual Studio in C ++ cross-platform, that is, Visual C ++ for Linux. With it, you can use the most advanced IDE for cross-platform development, so happy!

Visual C ++ for Linux

VC ++ 2017 supports writing and debugging C ++ programs under Linux ([Detailed (https://blogs.msdn.microsoft.com/vcblog/2016/03/30/visual-c-for-linux-development )).

Create a cross-platform Linux C ++ Program,

As shown in the actual usage, we can see that Linux code can be compiled under VS, even including linux-specific header files. In addition to Code Completion, code coloring, visual debugging, and other advantages.


Procedure

1. Install the compiling and debugging environments on the target linux machine, for example, openssh-server/g ++/gdb/gdbserver In ubuntu.

Sudo apt-get install openssh-server g ++ gdb gdbserver

2. visual studio 2017 is installed on the local machine. You need to install the Cross Platform Linux C ++ environment.

3. Open Visual Studio, create a project, and select Cross Platform/Linux/Console Application.

4. Before the first build, ssh will be required to connect to the target linux machine, and the user name and password will be filled in to connect to the target machine. If you need to change the address of the target machine, manage it in Tools/Options/Cross Platform.

5. Set a series of options (in the black box), which are basically the same as the settings of common Win32 programs. Note the following two points:

Vs will not automatically copy the header file in addtional include to the local machine to complete the code, you need to manually copy the/usr/include,/usr/local/include directories in linux to the linux header path (for example, C: \ Program Files (x86) of) \ Microsoft Visual Studio \ 2017 \ Community \ Common7 \ IDE \ VC \ Linux \ include \ usr)

Both the header file directory and the library file directory are absolute paths in linux.





6. During compilation, vs will copy the code to the target machine's ~ /Projects/[project-name] Directory, And the binary file is in the bin directory of its directory. For example, you can see that the Code already exists in the Linux environment.


Actual development

In the initial user experience, it seems that vs for linux is not very mature and there are many problems, including slow file copying speed, failure to multi-thread compilation, and loss of compilation and output information (unfriendly) and cannot operate the stepping stone.

However, this tool, as an auxiliary tool for coding, is still very valuable. It combines powerful code editing and debugging functions of vs with the natural server features of linux machines. Coming soon!

For more articles, see the home page.

The above is all the content of this article. I hope it will be helpful for your learning and support for helping customers.

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.