简体   繁体   中英

Build C++ in Powershell not CMD with Sublime Text 3

I'm wondering if there is a way to run builds in Sublime Text 3 so that it outputs in Powershell and not CMD.

{
    "cmd": ["gcc", "${file}", "-o", "${file_base_name}.exe"],
    "file_regex": "^(..[^:]*):([0-9]+):?([0-9]+)?:? (.*)$",
    "working_dir": "${file_path}",
    "selector": "source.c, source.c++",
    "shell": true,

    "variants":
    [
        {
            "name": "Run",
            "cmd": ["start", "cmd", "/k", "${file_path}/${file_base_name}.exe"],
            "shell": true
        }
    ]
}

This is the code I found online that will use MinGW as the compiler and allow you to press Ctrl + B to build a C++ program in ST3. When you do this the output goes to the CMD prompt. Is there a way to make the output go to Powershell instead?

This will work for sure.

    {
    "cmd": ["gcc", "${file}", "-o", "${file_base_name}.exe"],
    "file_regex": "^(..[^:]*):([0-9]+):?([0-9]+)?:? (.*)$",
    "working_dir": "${file_path}",
    "selector": "source.c, source.c++",
    "shell": true,

    "variants":
    [
        {
            "name": "Run",
            "cmd": ["start", "powershell", "-NoExit", "${file_path}//${file_base_name}.exe"],
            "shell": true
        }
    ]
}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM