Sublime文本2(Mac OS X)中的运行代码 [英] Running Code in Sublime text 2 ( Mac OS X )

查看:139
本文介绍了Sublime文本2(Mac OS X)中的运行代码的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试在崇高的文本2中运行C代码,并且我注意到scanf似乎被完全忽略了,尽管它在xcode和gcc终端中都可以正常工作. 我个人更喜欢崇高的文字外观,有没有办法解决这个问题?

I'm trying to run C code in sublime text 2 and i've noticed that scanf seems to be completely ignored, although it works fine in both xcode and in the terminal with gcc. I personally prefer the look of sublime text, is there a way to fix this?

推荐答案

在SO和

This has been discussed in several questions on SO, and the unofficial docs are currently being updated to more clearly state this: neither ST2 nor ST3 supports direct input to programs running within build systems inside Sublime Text: C/C++'s scanf and colleagues do not work, nor do Python's raw_input (Python 2) or input (Python 3), Ruby's gets, Java's Scanner class, etc. This is a fundamental limitation of the program.

但是,它可以通过两种方法解决.首先,您可以在终端中运行构建系统.其次,如果您使用的是JavaScript,Python,Ruby,Perl,Scheme等解释型语言,以及所有与Lisp相关的类似Lisp的语言(例如Clojure,Erlang,Haskell,PHP,R等),则可以查看出色的 SublimeREPL 插件.您可以打开REPL进行交互式编程,然后将程序(或其中的一些位)发送给REPL并与它们进行交互,就像在命令行上一样.文档位于此处.

However, it can be worked around in two ways. First, you can run your build system in a terminal. Second, if you are using an interpreted language like JavaScript, Python, Ruby, Perl, Scheme and all the associated Lisp-like languages like Clojure, Erlang, Haskell, PHP, R, etc., you can check out the excellent SublimeREPL plugin. You can open a REPL for interactive programming, and send programs (or bits of them) to it and interact with them just as on the command line. Documentation is here.

这篇关于Sublime文本2(Mac OS X)中的运行代码的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆