Skip to content

Instantly share code, notes, and snippets.

@qwo
Last active May 20, 2020 17:49
Show Gist options
  • Save qwo/9441259 to your computer and use it in GitHub Desktop.
Save qwo/9441259 to your computer and use it in GitHub Desktop.
Sublime C++11 Build System File
//ignore being compatible with C++99 and other warnings
{
"cmd": ["clang++","-std=c++11", "-w", "-stdlib=libc++", "-Weverything", "${file}", "-o", "${file_path}/${file_base_name}"],
"file_regex": "^(\S[^:\n]*):(\d+):(\d+): (.+)",
"working_dir": "${file_path}",
"selector": "source.c, source.c++",
"variants":
[
{
"name": "Run",
"cmd": ["bash", "-c", "clang++ -w -std=c++11 -stdlib=libc++ -Weverything '${file}' -o '${file_path}/${file_base_name}' && '${file_path}/${file_base_name}'"]
}
]
}
//with warnings
//compatible with sublime text 2 and 3
{
"cmd": ["clang++","-std=c++11","-stdlib=libc++", "-Weverything", "${file}", "-o", "${file_path}/${file_base_name}"],
"file_regex": "^(\S[^:\n]*):(\d+):(\d+): (.+)",
"working_dir": "${file_path}",
"selector": "source.c, source.c++",
"variants":
[
{
"name": "Run",
"cmd": ["bash", "-c", "clang++ -std=c++11 -stdlib=libc++ -Weverything '${file}' -o '${file_path}/${file_base_name}' && '${file_path}/${file_base_name}'"]
}
]
}
@grynko
Copy link

grynko commented Dec 17, 2014

Please correct std option for "Run" mode to -std=c++11 for c11.sublime-build

@makuto
Copy link

makuto commented Jul 23, 2017

I had better success with file_regex as:
^([a-zA-Z\/][^:\n]*):([0-9]+):?([0-9]+)?:? (.*)$
This works better with multiline error messages.

@hl4
Copy link

hl4 commented Jan 4, 2019

better file_regex

^(\S[^:\n]*):(\d+):(\d+): (.+)

@qwo
Copy link
Author

qwo commented Nov 1, 2019

never got the gist notifications.. incorporated the changes 🎉

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment