Set Up C++ Development With Visual Studio Code on Ubuntu 22.04 | VSCode C++ Development Basics

Поділитися
Вставка
  • Опубліковано 5 лют 2025
  • Learn how to set up C++ development with Visual Studio Code on Ubuntu 22.04. #C++ #VSCode #Ubuntu
    Visual Studio Code (VSCode) is a popular code editor that supports C++ development and offers a range of powerful features. Follow these steps to set up C++ development with Visual Studio Code on your Ubuntu 22.04 system:
    1. Install build essentials: Before getting started, ensure that you have the build essentials package installed on your Ubuntu system. Open a terminal and run the following command to install it:
    ```
    sudo apt-get install build-essential
    ```
    This package includes the necessary tools and libraries for building software.
    2. Install Visual Studio Code: Visit the official Visual Studio Code website (code.visualstudio.com) and download the Linux version suitable for your Ubuntu 22.04 system. Once downloaded, open the terminal and navigate to the directory where the downloaded file is located. Run the following command to install VSCode:
    ```
    sudo dpkg -i file_name .deb
    ```
    Replace ` file_name ` with the name of the downloaded file.
    3. Install the C++ extension: Launch Visual Studio Code. In the sidebar, click on the Extensions icon (represented by four squares). Search for the "C++" extension and click on "Install" to add it to your VSCode setup.
    4. Set up a C++ project: Open a new terminal within Visual Studio Code by clicking on "View" in the top menu, selecting "Terminal," and then "New Terminal." In the terminal, navigate to the directory where you want to create your C++ project.
    5. Create a C++ source file: Use the following command to create a new C++ source file:
    ```
    touch main.cpp
    ```
    This will create a new file named "main.cpp" in your current directory.
    6. Start coding: Open the "main.cpp" file in the Visual Studio Code editor and start writing your C++ code. You can use the integrated features of VSCode, such as IntelliSense, to assist you in coding.
    7. Build and run your code: To compile and run your C++ code, use the terminal within Visual Studio Code. Use the following commands:
    ```
    g++ main.cpp -o main
    ./main
    ```
    The first command will compile your C++ code, and the second command will execute the compiled program.
    Congratulations! You have now set up C++ development with Visual Studio Code on your Ubuntu 22.04 system. You can continue coding and exploring the various features and capabilities offered by Visual Studio Code to enhance your C++ development experience.
    #C++Development #VSCodeSetup #UbuntuDevelopment #CodeEditor #Programming

КОМЕНТАРІ • 43

  • @GoshaGaina
    @GoshaGaina Рік тому +6

    Огромное спасибо, правда. Я недавно установил линукс для учебы, ничего в этом не понимаю, даже читал документацию на официальном сайте, все равно были какие то launch файлы. Автор, ты просто нереальный и очень очень крутой. Спасибо 🤗🤗🫶

    • @concop231
      @concop231 3 місяці тому

      Тоже сейчас сижу умираю от открытия json файлов,не понимая, что с ними делать

    • @GoshaGaina
      @GoshaGaina 3 місяці тому

      @concop231 ооо привет

    • @GoshaGaina
      @GoshaGaina 3 місяці тому

      @@concop231 ты не должен их делать, когда все настроишь вскод будет сам их генерировать

    • @GoshaGaina
      @GoshaGaina 3 місяці тому

      @@concop231 проверь что скачал компилятор, $: g++ --version

    • @concop231
      @concop231 3 місяці тому

      @@GoshaGaina я скачиваю расширения для плюсов, пробую запустить файл и мне предлагают открыть json файл, а после все-равно дебаг не включается

  • @beanieteamie7435
    @beanieteamie7435 Місяць тому +4

    If you don't see the compiler options at 9:50 `sudo apt install gdb`. Then try again. This fixed it for me. (Pop OS)

  • @jonathanr4242
    @jonathanr4242 Рік тому +2

    Thanks. Hello world is the half way mark to coding.

  • @KaustubhGaur-c3z
    @KaustubhGaur-c3z 4 місяці тому +12

    My code is not compiling neither in Windows not in Ubuntu Vscode.
    It says *"The terminal process terminated with exit code: -1"*

    • @adhamwasfi6822
      @adhamwasfi6822 3 місяці тому +13

      Delete the full folder .vscode which contains files launch.json and task.json, and make sure to run for the first time using G++ and not GCC, and a new launch.json and task.json will be generated as a default compiler for cpp files. The problem is GCC and std::cout won't work together because GCC is a compiler for C and not c++.

    • @reimuhakurei5579
      @reimuhakurei5579 3 місяці тому

      ​@@adhamwasfi6822 Спасибо большое

    • @yunobokc4009
      @yunobokc4009 2 місяці тому

      @@adhamwasfi6822 Thank you!

    • @AHAD-p2n
      @AHAD-p2n Місяць тому

      such a legend!

    • @black-tie3363
      @black-tie3363 17 днів тому

      @@adhamwasfi6822 this worked for me. Thank you for explanation.

  • @Arajka_Raj
    @Arajka_Raj 10 місяців тому

    Thank you very much , Sir❤❤

  • @Lucky-zc2sp
    @Lucky-zc2sp 9 місяців тому +1

    Thank you i saw many videos but this one really helped me.

  • @techSaffron
    @techSaffron 4 місяці тому

    Thanks bro ur video are really help full ...

  • @frego-i9e
    @frego-i9e 3 місяці тому +1

    10.15 after I choose that it says " Errors exist running preLaunchTask 'C/C++:gcc build active file'. And I don't know what to do now. I ti is not about code I wrote I am sure about that but I don't know the what should I do anymore. Please Help

  • @noweare1
    @noweare1 Рік тому +2

    code-blocks is better, it has a memory view so you can see how everything is stored in memory. I use that a lot. Too bad vsc doesn't support that with g++/gcc.

  • @aryanakhauri2261
    @aryanakhauri2261 5 місяців тому

    Thanks a lot, appreciate it.

  • @jagatkrishna1543
    @jagatkrishna1543 Рік тому +1

    Thanks 🙏❤🎉

  • @Ykelary-e8g
    @Ykelary-e8g Рік тому +1

    Thank you very much

  • @anupamghoshh
    @anupamghoshh Рік тому +1

    very nice

  • @DevMugera
    @DevMugera Рік тому

    Asante sana(Thank you)

  • @rajeshloknath898
    @rajeshloknath898 8 місяців тому

    how to add environmental variable for a project in VS code ?

  • @chash_games
    @chash_games Рік тому +1

    thank you

  • @kashyapsaurabh5989
    @kashyapsaurabh5989 Рік тому

    Thnks bro❤

  • @gcs3495
    @gcs3495 9 місяців тому

    thanks a lot brother

  • @Aditya-es3zk
    @Aditya-es3zk Рік тому

    Thank youuu sooo muccchhhhhh

  • @MạnhNguyễnBá-p6l
    @MạnhNguyễnBá-p6l 9 місяців тому

    very helful

  • @studbanda9426
    @studbanda9426 8 місяців тому

    in mine it shows permission denied in case of bash terminal

  • @sireeshyadav2560
    @sireeshyadav2560 Рік тому

    Bro do for java programming also pleaseeeee❤

  • @youOnlyLive1ce
    @youOnlyLive1ce Рік тому

    thank yo bro

  • @VndNvwYvvSvv
    @VndNvwYvvSvv Рік тому +2

    "explain you"? lol, what?

    • @Krbydav328
      @Krbydav328 8 місяців тому +9

      you making fun of someone/acting dumbfounded for english not being their first language: 😂
      you trying to provide meaningful constructive criticism for the video: 😢

  • @snehildwivedi6141
    @snehildwivedi6141 Рік тому

    Bhai tmne setup ki jagh sab bta Diya not a video that I'll recommend 👎🏻👎🏻👎🏻