在數據結構代碼的編寫中,我選用了優秀的編輯器 Sublime Text 3,但是在實現C++代碼的編譯和運行上費了一番周折,接下來我貼出 C++ 編譯系統的代碼,供各位參考。
編譯后是在彈出的CMD命令行窗口運行的,因為若在 Sublime Text 3 運行則可能無法實現輸入等操作(?)。
1 { 2 "encoding": "utf-8", 3 "working_dir": "$file_path", 4 "shell_cmd": "g++ -Wall -std=c++11 -fexec-charset=GBK \"$file_name\" -o \"$file_base_name\"", 5 "file_regex": "^(..[^:]*):([0-9]+):?([0-9]+)?:? (.*)$", 6 "selector": "source.c++", 7 8 "variants": 9 [ 10 { 11 "name": "Run", 12 "shell_cmd": "g++ -Wall -std=c++11 -fexec-charset=GBK \"$file\" -o \"$file_base_name\" && start cmd /c \"\"${file_path}/${file_base_name}\" & pause\"" 13 } 14 ] 15 }
以上代碼也避免了因編碼問題導致的亂碼現象。
