Lập Trình Linux

VS Code setup for C and C++ development – building and debugging in Windows with Clang MSYS2




How to use VS Code to build and debug C and C++ programs under Windows 10 with Clang 8 from MSYS2. We present a debugging example.

Install Clang on Windows 10 with MSYS2 MinGW-w64 tutorial:

My settings, tasks and launch JSON files:

GDB install command (used in the MSYS2 terminal):
pacman -S mingw-w64-x86_64-gdb

Build command example for a C program:
clang -std=c17 -Wall -Wextra -pedantic test.c -o test

Build command example for a C++ program:
clang++ -std=c++17 -Wall -Wextra -pedantic test.cpp -o test

Nguồn:https://ftlinuxcourse.com/

Tin HOT
Chỉ thị số 16/CT-TTg của Thủ Tướng Chính Phủ về phòng, chống dịch COVID-19 I HANOITV
Lập Trình Linux
Best Linux Distros in 2019 for Beginners
Lập Trình Linux
Mỗi ngày 1 phần mềm EDIT VIDEO FREE # 01- DAVINCI RESOLVE16
  • can i get an explanation on how to use vs code for c++ on a mac? please and thank you.


  • For some reason, I tried to run an exe using ./Hello in the terminal but it doesn't show anything, can you help?


  • I couldn't make it work on version 1.39
    had to downgrade to 1.33 for it to work

    major change seems to be task.json is now independent and "preLaunchTask": on launch .json gives an error


  • My setup gives this error:
    tam12@SANDRO-Dell MINGW64 /c/DEV

    $ clang -std=c17 -Wall -Wextra -pedantic test.c -o test

    test.c:11:2: warning: no newline at end of file [-Wnewline-eof]

    }

    ^

    1 warning generated.
    i followed all instructions


  • When i tried to compile a C++ File it Said "$ clang -std=c17 -Wall -Wextra -pedantic test.cpp

    error: invalid argument '-std=c17' not allowed with 'C++'" …….What should i do ?


  • very nice.
    Video request:
    VS Code setup for C and C++ development – building and debugging in Windows with WSL ubuntu (gcc, gdb, make)