Lập Trình Linux

GCC & clang on windows with Visual Studio Code + bash terminal + debugging!




launch.json

{
“version”: “0.2.0”,
“configurations”: [

{
“name”: “(gdb) Launch”,
“type”: “cppdbg”,
“request”: “launch”,
“program”: “${workspaceRoot}/a.exe”,
“args”: [],
“stopAtEntry”: false,
“cwd”: “${workspaceRoot}”,
“environment”: [],
“externalConsole”: true,
“MIMode”: “gdb”,
“miDebuggerPath”: “C:/msys64/mingw64/bin/gdb.exe”,
“setupCommands”: [
{
“description”: “Enable pretty-printing for gdb”,
“text”: “-enable-pretty-printing”,
“ignoreFailures”: true
}
]
}
]
}

cpp_properties.json configuration

{
“name”: “MinGW”,
“intelliSenseMode”: “clang-x64”,
“includePath”: [
“${workspaceRoot}”,
“C:/msys64/mingw64/include”,
“C:/msys64/mingw64/include/c++/7.2.0”,
“C:/msys64/mingw64/include/c++/7.2.0/tr1”,
“C:/msys64/mingw64/include/c++/7.2.0/x86_64-w64-mingw32”,
“C:/msys64/mingw64/x86_64-w64-mingw32/include”
],
“defines”: [
“_DEBUG”,
“UNICODE”,
“__GNUC__=7”,
“__cdecl=__attribute__((__cdecl__))”
],
“browse”: {
“path”: [
“C:/msys64/mingw64/lib/*”,
“C:/msys64/mingw64/include”,
“C:/msys64/mingw64/include/c++/7.2.0”,
“C:/msys64/mingw64/include/c++/7.2.0/tr1”,
“C:/msys64/mingw64/include/c++/7.2.0/x86_64-w64-mingw32”,
“C:/msys64/mingw64/x86_64-w64-mingw32/include”
],
“limitSymbolsToIncludedHeaders”: true,
“databaseFilename”: “”
}
}

user settings json

{
“terminal.integrated.shell.windows”: “C:\msys64\usr\bin\bash.exe”,
“terminal.integrated.shellArgs.windows”: [“-i”],
“terminal.integrated.env.windows”: { “PATH” : “/mingw64/bin:/usr/local/bin:/usr/bin:/bin:/c/Windows/System32:/c/Windows:/c/Windows/System32/Wbem:/c/Windows/System32/WindowsPowerShell/v1.0/” }
}

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

Xem Thêm Bài Viết Khác:https://ftlinuxcourse.com/lap-trinh-linux

Tin Tức về Linux
Tạo map train quái – JX Linux – Jackie Gaming
Lập Trình Linux
I Failed the LPI Linux Essentials Exam** & Cyber Security Month
Lập Trình Linux
How to Configure CentOS LocalTime and PHP Timezone
  • I almost lost the hope for using VS code because all of a sudden "The terminal process terminated with exit code : Number"
    Thanks for the posting the video


  • can u do it with llvm-project


  • I did it without posix emulation. By enabling symlinks in window and symlinking libgcc.a to libgcc_he.a
    No need for dynamic linking..


  • Thanks you helped a lot


  • exactly what i needed


  • Wait If the terminals Bash Do i have to change the whole thing all over again to run Python programs. ??


  • Mate this is GREAT!!! I can now compile and debug/run – g++/Clang++ vscode!


  • Is there any way to run java with this too? For some reason I have all of it setup, but can't run java files. Maybe it's obvious, please help


  • can we update the gcc version available?


  • how do I use python now on vscode


  • many thanks, i was dont know how to, but now i know


  • Hello, good video, but I´m confused about the value of PATH, this must be exactly the same that the value of the Path on the environment values? I hope you can help me, since I'm still a beginner in C. thanks in advance.


  • Brilliant explanation. Easy to understand. I will recommend for any novice to set his environment using this video


  • I have MingW64 already installed (GitBash terminal) and linked to my VSCode text editor
    however it doesn't take pacman commands, or gcc
    so I followed this video and ran into an ONSLAUGHT of errors when you ran cmdline
    "pacman -S ming…"
    i'm talking over 600 lines of error saying it didn't work.
    why?
    is this video never going to get a reply? it makes no sense to me but ican not use CLANG or LLVM on my new laptop in vscode and i'm just pissed. I can't find anything useful. not even the link in extensions given by vscode "intall clang" click clang, takes you site and doesn't say which one you download.
    whatever. igive up


  • why not use WSL?


  • i am doing this tutorial and I am unsure where I went wrong on 8:57 my bash is wrong somehow because it keeps saying "bash: cut: command not found"


  • Awesome it worrrrrks!!!


  • Thank you for this tutorial! Do you know why i have this problem: "ERROR: Unable to start debugging. Unexpected GDB output from command "-exec-run"." ?


  • Worked great. Thank you so much!


  • This is how to turn a text editor into an IDE. Anyway it's easier to just use Code Blocks.


  • AidenAiden

    Author Reply

    Jesus… your voice is so relaxing


  • The hero we don't deserve.


  • I did exactly what has been shown but after changing the terminal I'm just left with nothing being there. Could anyone help?


  • c++ on vscode dosn't worth. 1milion times to use vs2017 for this job


  • zZE94zZE94

    Author Reply

    Amazing. Thank you so much. I was trying to figure out since a few days how to use clang with some IDE and everyday, I gave up. This time continuously searching for 12 hours now, your video has been a blessing. I understand so much now. You equipped me with the knowledge of not just using a compiler for VSCode but for any other text editor as well. Thank you so much!


  • clang++ is producing a.out
    in 13.48 it must be ./a.out


  • easy way: https://medium.com/@jerrygoyal/run-debug-intellisense-c-c-in-vscode-within-5-minutes-3ed956e059d6


  • error failed retrieving file. Help


  • I couldn't install anything –error: GPGME error: Invalid crypto engine – a little searching suggested changing pacman.conf to disable the checking, except…. there is no editor installed, and none can be installed without turning off the check – somewhat annoying


  • Great! .. up and running .. however.. Bash cannot run any commands.. " bash: cut: command not found" node is installed.. npm is installed.


  • I like the quality sound man. And great tutorial. I coudn't stand CodeBlocks anymore.