mac sublime text 3 arranged at c / c ++

mac sublime text C/C++

  • Click Tools-> Build System->Build New System

  • Then enter the following configuration:
{
    "cmd": ["bash", "-c", "g++ '${file}' -std=c++11 -stdlib=libc++ -o '${file_path}/${file_base_name}'"],
    "file_regex": "^(..{FNXX==XXFN}*):([0-9]+):?([0-9]+)?:? (.*)$",
    "working_dir": "${file_path}",
    "selector": "source.c, source.c++",
    "variants":
    [
        {
        "name": "Run",
        "cmd": ["bash", "-c", "g++ '${file}' -std=c++11 -stdlib=libc++ -o '${file_path}/${file_base_name}' && open -a Terminal.app '${file_path}/${file_base_name}'"]
        }
    ]
}

  • Then press Command+Ssave and name C/C++.sublime-build, the name C/C++you just play, but the extension and save the path will not change, the default on the line

This configuration file will be saved in /Users/用户名/Library/Application Support/Sublime Text 3/Packages/Usercase

  • Then you can now write c / c ++ code, and then finished, click Tools-> Build System->C:C++

Note that, because I just saved when the file name C/C++, which /is automatically replaced :, and all C:C++that is, I just saved configuration file

  • After the compiler finished selecting, press Command+B, and then choose C:C++ - Runto run, the next press Command+Bcan run


Published 40 original articles · won praise 55 · views 80000 +

Guess you like

Origin blog.csdn.net/A807296772/article/details/88636025