ไม่สามารถเล่นวิดีโอนี้
ขออภัยในความไม่สะดวก

Install and Run C++ in Visual Studio Code (Linux) (Ubuntu, Debian, Linux Mint...)

แชร์
ฝัง
  • เผยแพร่เมื่อ 11 ก.ค. 2023
  • To install and run C++ in Visual Studio Code on Linux (Ubuntu, Debian, Linux Mint, etc.), you can follow these steps:
    1. Install Visual Studio Code: Download and install Visual Studio Code from the official website or through your package manager.
    2. Install C++ Tools: Open Visual Studio Code and go to the Extensions view by clicking on the square icon on the left sidebar or pressing `Ctrl+Shift+X`. Search for the "C++" extension and click on the "Install" button to install it.
    3. Install C++ Compiler: Install a C++ compiler, such as GCC or Clang, on your Linux distribution. Open a terminal and run the following command:
    For GCC:
    ```
    sudo apt-get install build-essential
    ```
    For Clang:
    ```
    sudo apt-get install clang
    ```
    4. Set Up a C++ Project: Create a new folder for your C++ project. Open the folder in Visual Studio Code by selecting "File" - "Open Folder" from the menu. Alternatively, you can use the terminal to navigate to the project folder and run `code .` to open it in Visual Studio Code.
    5. Create a C++ File: Inside the project folder, create a new file with a `.cpp` extension, such as `main.cpp`. This will be your C++ source file.
    6. Write C++ Code: Open the `main.cpp` file in the Visual Studio Code editor and write your C++ code.
    7. Configure Build Tasks: Press `Ctrl+Shift+B` to open the command palette and search for "Tasks: Configure Default Build Task". Select the option and choose "g++ build active file" to configure the build task for compiling your C++ code.
    8. Build and Run: Press `Ctrl+Shift+B` again to build and compile your C++ code. The output will be displayed in the integrated terminal. You can run the program by typing `./executable_name` in the terminal.
    By following these steps, you can install and run C++ in Visual Studio Code on Linux. Visual Studio Code provides a powerful and customizable environment for C++ development, allowing you to write, build, and run your C++ programs efficiently.
    #VisualStudioCode #C++ #Linux #Ubuntu #Debian #LinuxMint #Cplusplus #CplusplusDevelopment #CplusplusCompiler #CodeEditor #DevelopmentEnvironment #CppDevelopment #CppProgramming #CppCompilation #CppBuildTasks

ความคิดเห็น • 10