Home Development Tools sublime How to run sublime test in c++ language

How to run sublime test in c++ language

Apr 03, 2024 pm 12:00 PM
linux sublime c++

The steps to run a C program in Sublime Text are as follows: Install MinGW or Clang compiler Set up the corresponding build system Write and save the C code with ".cpp" extension Press Ctrl B or Cmd B to build the program Press Ctrl F5 or Cmd F5 to run the program

How to run sublime test in c++ language

How to run C language in Sublime Text

Run Steps of C program

Running a C program in Sublime Text requires the following steps:

  1. Install the compiler:First, you need to install a C compiler device. It is recommended to use MinGW or Clang.
  2. Set up the build system: Next, you need to set up a build system for Sublime Text. This tells Sublime Text how to compile and run the program. Tools -> Build System -> New Build System..., and then select the appropriate compiler.
  3. Write and Save Code: In Sublime Text, write and save your C code. Use files with the ".cpp" extension.
  4. Build the program: Press Ctrl B (Windows/Linux) or Cmd B (Mac) to build the program. This will compile the code and generate an executable file.
  5. Run the program: Press Ctrl F5 (Windows/Linux) or Cmd F5 (Mac) to run the program. This will open a terminal window and run the executable file within it.

Detailed instructions

  • Compiler installation:

    • MinGW: https://sourceforge.net/projects/mingw-w64/
    • Clang: https://clang.llvm.org/
  • Build system settings:

    • MinGW: `json
      {
      "cmd": ["g ", "-std=c 17", "${file}"],
      "file_regex": "^(..1):([0-9] ):? ([0-9] )?:? (.)$",
      "selector": "source.cpp"
      }

    • Clang:

      {
      "cmd": ["clang++", "-std=c++17", "${file}"],
      "file_regex": "^(..[^:]*):([0-9]+):?([0-9]+)?:? (.*)$",
      "selector": "source.cpp"
      Copy after login
  • Code writing:

    #include <iostream>
    
    int main() {
        std::cout << "Hello, world!" << std::endl;
        return 0;
    Copy after login
<code>* **构建和运行:**
* **Ctrl + B** / **Cmd + B**(构建)</code>
Copy after login

  1. :

The above is the detailed content of How to run sublime test in c++ language. For more information, please follow other related articles on the PHP Chinese website!

Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

The Performance Race: Golang vs. C The Performance Race: Golang vs. C Apr 16, 2025 am 12:07 AM

Golang and C each have their own advantages in performance competitions: 1) Golang is suitable for high concurrency and rapid development, and 2) C provides higher performance and fine-grained control. The selection should be based on project requirements and team technology stack.

How to switch Chinese mode with vscode How to switch Chinese mode with vscode Apr 15, 2025 pm 11:39 PM

VS Code To switch Chinese mode: Open the settings interface (Windows/Linux: Ctrl, macOS: Cmd,) Search for "Editor: Language" settings Select "Chinese" in the drop-down menu Save settings and restart VS Code

What is the main purpose of Linux? What is the main purpose of Linux? Apr 16, 2025 am 12:19 AM

The main uses of Linux include: 1. Server operating system, 2. Embedded system, 3. Desktop operating system, 4. Development and testing environment. Linux excels in these areas, providing stability, security and efficient development tools.

vscode Previous Next Shortcut Key vscode Previous Next Shortcut Key Apr 15, 2025 pm 10:51 PM

VS Code One-step/Next step shortcut key usage: One-step (backward): Windows/Linux: Ctrl ←; macOS: Cmd ←Next step (forward): Windows/Linux: Ctrl →; macOS: Cmd →

How to use VSCode How to use VSCode Apr 15, 2025 pm 11:21 PM

Visual Studio Code (VSCode) is a cross-platform, open source and free code editor developed by Microsoft. It is known for its lightweight, scalability and support for a wide range of programming languages. To install VSCode, please visit the official website to download and run the installer. When using VSCode, you can create new projects, edit code, debug code, navigate projects, expand VSCode, and manage settings. VSCode is available for Windows, macOS, and Linux, supports multiple programming languages ​​and provides various extensions through Marketplace. Its advantages include lightweight, scalability, extensive language support, rich features and version

vscode setting Chinese tutorial vscode setting Chinese tutorial Apr 15, 2025 pm 11:45 PM

VS Code supports Chinese settings, which can be completed by following the steps: Open the settings panel and search for "locale". Set "locale.language" to "zh-CN" (Simplified Chinese) or "zh-TW" (Traditional Chinese). Save settings and restart VS Code. The settings menu, toolbar, code prompts, and documents will be displayed in Chinese. Other language settings can also be customized, such as file tag format, entry description, and diagnostic process language.

How to type multiple lines of comments in vscode How to type multiple lines of comments in vscode Apr 15, 2025 pm 11:57 PM

VS Code The methods of multi-line commenting are: 1. Shortcut keys (Ctrl K C or Cmd K C); 2. Manually add comment symbols (/ /); 3. Select menu ("Comment Block"); 4. Use extensions; 5. Recursive comments (/* /) and block comments ({/ and /}). Multi-line comments help improve code readability and maintainability, but overuse should be avoided.

How to compile vscode How to compile vscode Apr 16, 2025 am 07:51 AM

Compiling code in VSCode is divided into 5 steps: Install the C extension; create the "main.cpp" file in the project folder; configure the compiler (such as MinGW); compile the code with the shortcut key ("Ctrl Shift B") or the "Build" button; run the compiled program with the shortcut key ("F5") or the "Run" button.

See all articles