Mac build a C language environment
Create a project directory
/Users/chennan/cproject
Configuration sublime operating environment
Open sublime text3, the following steps with a single click
Tools(工具)-》Build System(编译系统)-》New Build system(新建编译系统)
Opens a configuration file, enter the following
{
"cmd": ["gcc", "${file}", "-o", "${file_path}/${file_base_name}"],
"file_regex": "^(..[^:]*):([0-9]+):?([0-9]+)?:? (.*)$",
"working_dir": "${file_path}",
"selector": "source.c, source.c++",
"variants":
[
{
"name": "Run",
"cmd" : ["${file_path}/${file_base_name}"]
}
]
}
Then save it as a named C.sublime-build
Create the first C file
touch hellodj.c
Then open the file
if configured sublime environment variable can be opened with the following command, and I feel better than vim Haoshi
command mode configuration sublime of
open zsh file add the following
alias subl="open -a Sublime\ Text"
Then you can use the command to open the sublime text subl how kind is not very simple.
subl hellodj.c
Enter the following
#include<stdio.h>
int main()
{
/* code */
printf("hello dj\n");
return 0;
}
The first run a C program
Then enter control + b can be run for the first time will prompt C single File and C single File run in the middle portion of the file, select the second option with the mouse on it, and then next time to finish the program directly control + b to