How to Set Up C++ in Visual Studio Code - Download & Install C++ & C in VSCode

Sdílet
Vložit
  • čas přidán 25. 03. 2024
  • VSCode Link:- code.visualstudio.com/
    C++ Install Link:- code.visualstudio.com/docs/cp...
    MSYS2 Command :- pacman -S --needed base-devel mingw-w64-ucrt-x86_64-toolchain
    Environment Variable Path:- C:\msys64\ucrt64\bin
    VSCode Compiler Path:- C:\\msys64\\ucrt64\\bin\\g++.exe
    1. Open Your Browser
    2. Type "Visual Studio Code" in Google
    3. Click First Link:- code.visualstudio.com/
    4. Click Download Button
    5. This Will Automatically Start Downloading. if it Does not Start Then Click "direct download link"
    6. Wait For Download to Finish
    7. Click To Install VSCode
    8. Now Follow The Installation Process As Shown in This Video
    9. Now Click C++ This WIl Expand C++ Menu
    10. Now Click on "GCC on Windows" Link:- code.visualstudio.com/docs/cp...
    11. Now Scroll Down Until You Find "direct link to the installer"
    12. Click "direct link to the installer"
    13. Wait For Download To Start
    14. Wait For Download To Finish
    15. Click To Install MSYS2
    16. Click Next Button
    17. Click Next Button
    18. Click Next Button
    19. Wait For Installation Process To Finish
    20. Click Finish Button
    21. This Will Open MSYS2 if MSYS2 Does not Open Automatically Then Follow Next Step
    22. if MSYS2 Does not Open Automatically Then Search "MSYS2 MSYS"
    23. Click "MSYS2 MSYS"
    24. Now Go Back To VSCode Page & Copy Command
    25. Go Back To MSYS2
    26. Right-Click in MSYS2 & Click Paste To Paste The Command & Hit Enter on Your Keyboard
    27. Hit Enter on Your Keyboard When You See Something Like This
    28. Now Type Y & Hit Enter on Your Keyboard
    29. Now Wait For Downloading & Installation Proesss To Finish
    30. Now Close MSYS2
    31. Scroll Down Until You Find Path As Shown in The Video
    32. Copy This Path
    33. Search "edit the system environment variables"
    34. Click "Edit the system environment variables"
    35. Click "Environment Variables" Button
    36. Click Path & Then Click Edit Button
    37. Click New Button
    38. Now Paste The Path Which We Previously Copied
    39. Click OK Button
    40. If There is no Path in the List Then You can Create By Clicking New Button
    41. Type Variable name as Path & in Variable Value Type Your Path You Have Copied
    42. Click OK Button (Only Do This if There is no Path in The list Else Skip This Step)
    43. Click OK Button
    44. Click OK Button
    45. Now Search cmd
    46. Click Command Prompt
    47. Go Back to the VSCode Website, & Copy the Following Code One by One: gcc --version, g++ --version, & gdb --version. Then, Paste Each of Them Into the Command Prompt & Hit Enter on Your Keyboard. This Code Ensures That C++ is Successfully Installed on Your Computer (Codes in Description)
    48. Close Command Prompt
    49. Minimize Your Browser
    50. Open Visual Studio Code
    51. Click Extensions iCon
    52. Type C++ & Hit Enter on Your Keyboard
    53. Click "C/C++ Extension Pack"
    54. Click Install Button
    55. Close C/C++ Extension Pack Tab
    56. Close VSCode
    57. Again Open VSCode
    58. Click File
    59. Click "New Text File"
    60. Click "Select a Language"
    61. Click "C++ (cpp)" or "C (C)" Depend on Your Prefered Language
    62. Now Type You C++ or C Code
    63. Click File
    64. Click Save
    65. Go To Location Where You Want to Save Your C++ or C File & Then Type Your File Name
    66. Ensure That C++ or C is Selected as "Save as type"
    67. Click Save Button
    68. Try to Run the Code. If There is Any Error in the Include, Then Continue Watching This Video. It Will Show How to Fix It
    69. Now Click on The Compiler That Contains "C:\msys64\ucrt64\bin\g++.exe"
    70. Code is Running Now I Will Show How To Fix Include Error
    71. Here is The include Error That You Might Face To Fix This Error Follow The Steps
    72. Click Extensions iCon
    73. Type C++ & Hit Enter on Your Keyboard
    74. This Time Click C/C++ instead of C/C++ Extension Pack
    75. Click Settings iCon
    76. Click "Extension Settings"
    77. Now Leave Blank Space Beside @ext:ms-vscode.cpptools & Type Comiler Path
    78. Ensure That "C_Cpp › Default: Include Path", "C_Cpp › Default: System Include Path" & "C_Cpp › Default: Compiler Args" Has No Value If There are Any Values You Can Reset it
    79. To Reset Just Hover Your Mouse Over "C_Cpp › Default: Include Path", "C_Cpp › Default: System Include Path" & "C_Cpp › Default: Compiler Args"
    80. Then Click The Settings
    81. Click Reset setting
    82. Do Same With Other Two if There are Any Values Reset Them As We Did Previously
    83. Now Click "Edit in settings.json" Under "C_Cpp › Default: Compiler Path"
    84. Go Back To Your Browser & Again Copy The Same Path We Copied Previously From VSCode Website
    85. Again Copy The Path We Copied Previously
    86. Go Back To Visual Studio Code
    87. Now Paste The Path Beside "C_Cpp.default.compilerPath" As Shown in This Video
    88. Now Change All Single Backslash To Double As Shown in Video
    89. After bin Add Double Backslash & Then Type g++.exe
    90. Click File
    91. Click Save
    92. Now Go Back To Your Code File to Check if Error is Fixed or not
    93. Error is Fixed Now Run The Code
    94. Now Click on The Compiler That Contains "C:\msys64\ucrt64\bin\g++.exe"
    95. Done
  • Jak na to + styl

Komentáře •