2013-08-25 62 views
3

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

这里是我的建造轮廓:

{ 
    "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; 
} 
+0

[在Sublime text 2(Mac OS X)中运行代码]的可能重复(https://stackoverflow.com/questions/27690657/running-code-in-sublime-text-2-mac-os-x) – OdatNurd

回答

相关问题