我在mac上使用sublime text编译c++程序,当程序有错时,编译器会完全没有提示。请问该如何获得提示?
比如:我在第二个printf中故意输错result,cmd+B编译后,完全没有反应,也不提示。
如果输入正确,结果如下:
巴扎黑2017-04-17 13:24:02
Your sublimetext build system is not set up properly
Click Tools->Build System-> new Build system, copy the code below and save it. The name will be c++11. Then you can select the c++ you just created in the build system. +11.
PS: This script will not only compile but also run automatically
{
"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}'"]
}
]
}
阿神2017-04-17 13:24:02
General method:
Install Xcode
Open Terminal
cd to the directory where cpp is located
Input clang++ name.cpp
Compile
Enter ./a.out
to run