- Tools → Build System → New build system...
- Paste the content below
{
"cmd": ["g++ ${file} -o ${file_path}/${file_base_name} && echo 'Build Finished' && ${file_path}/${file_base_name}"],
"shell" : true
}
- Save as
C++ Build and Run.sublime-build
- Open a C++ file
- Select Tools → Build System → C++ Build and Run
- cmd + b
@gospodinove Try this ->
{
"cmd": ["g++", "-Wall", "-ansi", "-pedantic-errors", "$file_name", "-o", "${file_base_name}.exe", "&&", "start", "cmd", "/k" , "$file_base_name"],
"selector": "source.cpp",
"working_dir": "${file_path}",
"path": "C:/MinGW/bin", // Path of installed gcc compiler directory
"shell": true
}
It worked for me.