gpt4 book ai didi

c++ - 用于 OS X 的 Sublime Text 3 C++ 构建系统

转载 作者:太空狗 更新时间:2023-10-29 23:17:23 24 4
gpt4 key购买 nike

我在 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;
}

最佳答案

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

编辑:

查看此线程 here寻求解决方法。

关于c++ - 用于 OS X 的 Sublime Text 3 C++ 构建系统,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18428929/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com