【问题标题】:Sublime Text 3 C++ Build System for OS X适用于 OS X 的 Sublime Text 3 C++ 构建系统
【发布时间】:2013-08-28 01:05:46
【问题描述】:

我在 OS X (Mountain Lion) 中使用 Sublime Text 3。我正在尝试在 Sublime Text 3 中构建和运行一个简单的 hello world 应用程序。它工作正常,但是当我接受任何输入时,它不会提示任何控制台输入。它只是直接运行并显示输出而不需要任何输入。

这是我的构建配置文件:

{
    "cmd": ["g++", "${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",
            "cmd": ["bash", "-c", "g++ '${file}' -o '${file_path}/${file_base_name}' && '${file_path}/${file_base_name}'"]
        }
    ]
}

示例程序:

#include <iostream>

using namespace std;

int main() {
    int number;

    cout << "Enter number: ";
    cin >> number;
    cout << "You entered: " << number;

    return 0;
}

【问题讨论】:

标签: c++ macos sublimetext3


【解决方案1】:

根据this thread,ST 根本不允许交互式构建。

编辑

查看此线程 here 以了解解决方法。

【讨论】:

    猜你喜欢
    • 2013-10-14
    • 1970-01-01
    • 1970-01-01
    • 2015-04-16
    • 1970-01-01
    • 2014-10-21
    • 2015-03-01
    • 2020-10-07
    相关资源
    最近更新 更多