sublime c++编译配置

1、C++11

如果需要编译c++11源文件,则需要更改编译配置。新建build system

{
    	"cmd": ["g++", "-Wall","-fexceptions", "-g", "-std=c++11","${file}", "-o", "${file_path}/${file_base_name}"],
    	"file_regex": "^(..[^:]*):([0-9]+):?([0-9]+)?:? (.*)$",
    	"working_dir": "${file_path}",
    	"selector": "source.c, source.c++",
    	"encoding":"cp936",
    	"variants":
    	[
       		{
           			"name": "Run",
			           "cmd": ["cmd", "/c", "g++", "-Wall","-fexceptions", "-g", "-std=c++11", "${file}", "-o", "${file_path}/${file_base_name}", 					"&&", "cmd", "/c", "${file_path}/${file_base_name}"]
       		},
		       {
     			      "name": "RunInCommand",
     			      "cmd": ["cmd", "/c", "g++","-Wall","-fexceptions", "-g", "-std=c++11","${file}", "-o", "${file_path}/${file_base_name}", 			"&&", "start", "cmd", "/c", "${file_path}/${file_base_name} & echo.&pause"]
		       }
   	]
}

保存为c++11.sublime-build。 ctrl+B 编译,ctrl+shift+B执行

Leave a Reply

Your email address will not be published. Required fields are marked *