在命令行新建一个文件,名字叫Makefile:touch Makefile然后用vi打开Makefile在里面写:test:gcc test.c -o test // 这里自己改文件名字保存退出然后执行make命令就行。