Workflow for writing C + + in Visual Studio code

Source: Internet
Author: User



1. Download the Visual Studio Code, install the website. Follow the prompts to install the CPP plugin and the CMake plugin.



Download CMake, install the website.



Download Mingw, install the website.






When installing MINGW, be careful to tick mingw32-automake, Mingw32-base, MINGW32-GCC, mingw32-gcc-g++, Msys-base, Mingw32-binutils, Mingw32-gdb.






2. File->open folder to open the project directory.



The directory for the folder should be


ProjectDir
     - src/ #project source
     - lib/ #project dependencies
     - doc/ #project documentation
     - build/ #build directory 


3. Create the corresponding CMakeLists.txt file in each directory, open the CMake, set the source code directory to ProjectDir, set the build directory to Projectdir/build, click Configure, select Gene Rator for Mingw Makefile, set Cmake_build_type to Debug, then point Generate, Generate Makefile, and then in CMD CD to build directory, run Mingw32-make, in B In, an executable file is available.






4. In Visual Studio Code, click on the Fourth button on the left, which is the Debug button, press run, select C + + (GDB/LLDB) will generate a Launch.json file in the. Vscode directory, change the file "program" to "${workspaceroot}/build/bin/xx.exe", change "Midebuggerpath" to "C:\\mingw\\bin\\gdb.exe". Then set the breakpoint, run, you can debug it.






Reference:



Http://www.cnblogs.com/ode/archive/2011/08/01/2143541.html



http://blog.csdn.net/dbzhang800/article/details/6314073



Workflow for writing C + + in Visual Studio code


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.