Home  >  Article  >  Development Tools  >  How to run sublime test in c language

How to run sublime test in c language

下次还敢
下次还敢Original
2024-04-03 11:24:181285browse

How to run C in Sublime Text

Sublime Text is a popular text editor for a variety of programming languages, including C. Here's how to run C programs in Sublime Text:

Install the compiler

First, you need to install a C compiler on your system. Recommend MinGW or Clang.

  • MinGW: Download and install from https://sourceforge.net/projects/mingw/.
  • Clang: Download and install from https://releases.llvm.org/download.html.

Set up Sublime Text

Next, you need to set up the compiler in Sublime Text.

  1. Open Sublime Text.
  2. Go to the menu bar and select "Tools" -> "Build System" -> "New Build System".
  3. Enter a name (for example, "C") in the "Name" field.
  4. Enter the following in the "Command" field:
<code>gcc -Wall -o "${file_base_name}" "${file_name}"</code>
  1. Enter the following in the "Selector" field :
<code>source.c</code>
  1. Click the "Save" button.

Run the program

Now you can run the C language program.

  1. Create a new Sublime Text file and save it as a .c file.
  2. Write your C code.
  3. Select "Tools" -> "Build System" -> "C" in the menu bar.
  4. Press "Ctrl B" (Windows) or "Cmd B" (Mac) to run the program.

If your code does not have any errors, Sublime Text will compile and run the program and display the output to the "Console" panel.

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:
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