我在mac上使用sublime text编译c++程序,当程序有错时,编译器会完全没有提示。请问该如何获得提示?
比如:我在第二个printf中故意输错result,cmd+B编译后,完全没有反应,也不提示。
如果输入正确,结果如下:
巴扎黑2017-04-17 13:24:02
你的 sublimetext 的 build system 沒設定好
點Tools->Build System-> new Build system, 複製下面的程式碼進去然後儲存,名字就叫c++11好了. 然後你就可以在build system 裡面選擇你剛才建立的c++11 .
PS: 這個腳本不只會編譯而且會自動 run
{
"cmd": ["g++", "-std=c++0x", "${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":["bash", "-c", "g++ -std=c++0x '${file}' -o '${file_path}/${file_base_name}' && '${file_path}/${file_base_name}'"]
}
]
}