Home > Development Tools > sublime > body text

How to run sublime test in c language

下次还敢
Release: 2024-04-03 11:24:18
Original
1311 people have browsed it

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>
Copy after login
  1. Enter the following in the "Selector" field :
<code>source.c</code>
Copy after login
  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!

Related labels:
source:php.cn
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!