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/
Xem thêm Bài Viết:
- Trải nghiệm mới hay ho với hướng dẫn cài Mac Os trên vmware
- Bật mí cách cài đặt ssl miễn phí lên Let’s Encrypt
- Tuyệt chiêu tạo usb boot kali linux đơn giản dành cho bạn
- Hướng dẫn chi tiết từ A – Z các bước cài đặt Python trên Windows 10
- Bật mí quy trình cài đặt Kali Linux trên Vmware đúng chuẩn và chi tiết
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)