By default Sublime Text does not build C++ with C++ 11 features. Follow below steps to activate c++ 11 building feature in Sublime Text 3. Steps are tested on Windows. I don’t think this will be too different on Mac or Linux except the keyboard shortcut.
- Install PackageResourceViewer plugin
- Open the command center by entering Ctrl + Shift + p
- Type “PackageResourceviewer: Open Resource”
- Then C++ –> C++ Single File.Sublime-build , this will open the build config file for C++
- Where ever you see g++ add -std=c++11 infront of it and save the file
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"shell_cmd": "g++ -std=c++11 \"${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", | |
"shell_cmd": "g++ -std=c++11 \"${file}\" -o \"${file_path}/${file_base_name}\" && \"${file_path}/${file_base_name}\"" | |
} | |
] | |
} |
It worked on linux.
thank you 🙂
thanks alot
thank you 🙂
Thanks!
Thanks.