如何在Sublime Text中編譯C和C++(How To Compile C&C++ in Sublime Text)

How To Compile C&C++ in Sublime Text

Yanwei Liu
1 min readDec 15, 2019

This article is base on Sublime Text 3 在終端機 編譯 c 或 c++ [ CMD 命令 輸入 scanf cin windows linux ]

Step 1 Install MingGW

Install MingGW AutoInstall.exe

Step 2 Restart your Computer

Step 3 Open your CMD

type gcc & g++ and see the output. It should look like the result below

$ gccgcc: fatal error: no input files
compilation terminated.
& g++
g++: fatal error: no input files
compilation terminated.

if error occurred, you can set your environment variable manually. Just follow the image below

Step 4 Open Sublime Text

Copy and paste the code below

#include <stdio.h>main()
{
printf("Hello\nWorld!\n");
}

For C:

Press Ctrl+B -> Choose C Single File — Run

For C++:

Press Ctrl+B -> Choose C Single File — Run

Now, you can see the output like this:

Hello
World!
[Finished in 0.2s]

--

--