如何在Sublime Text 2,Windows 8中构建和运行c ++程序? [英] How to build and run c++ programs in Sublime Text 2, Windows 8?

查看:277
本文介绍了如何在Sublime Text 2,Windows 8中构建和运行c ++程序?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是一个新手程序员。



我安装了Sublime Text 2,复制粘贴的hello(我已经安装了Sublime Text 2)。我已经安装了Codeblocks with mingw(不知道这是什么意思),选择默认编译器,世界程序:

  //我在C ++中的第一个程序

#include< iostream>

using namespace std;

int main()
{
cout< 你好,世界!;
return 0;
}

然后我构建,得到错误信息:

  [错误2]系统找不到指定的文件
[cmd:[u'bash',u'-c',ug ++' '-o'/'&&'/']]
[dir:C:\Windows \system32]
[路径:C:\Windows \ system32; \Windows; C:\Windows\System32\Wbem; C:\Windows\System32\WindowsPowerShell\v1.0\]
[完成]



我需要做什么才能使用Sublime Text 2运行一个简单的程序?

解决方案

解决。 Sublime Text 2需要g ++,bash等才能编译。这些软件包需要按照本页上的说明安装在您的计算机上:



http://www.claremontmckenna.edu/pages/faculty/alee/g++/g++.html



重要事项:建立并运行之前,请确保您正在处理的文件位于驱动器上的任何位置。


I am a novice programmer. I have installed Codeblocks with mingw (dont really know what that means), chose default compiler, and could build and run fine.

I installed Sublime Text 2, copy pasted hello world program:

// my first program in C++

#include <iostream>

using namespace std;

int main ()
{
    cout << "Hello World!";
    return 0;
}

I then build, get error message:

[Error 2] The system cannot find the file specified
[cmd:  [u'bash', u'-c', u"g++ '' -o '/' && '/'"]]
[dir:  C:\Windows\system32]
[path: C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\]
[Finished]

What do I need to do in order to run a simple program using Sublime Text 2?

解决方案

Solved. Sublime Text 2 needs g++, bash, etc in order to compile. These packages need to be installed on your computer, as per the instructions on this page:

http://www.claremontmckenna.edu/pages/faculty/alee/g++/g++.html

IMPORTANT: Make sure you save the file you're working on, wherever on your drive, before building and running.

这篇关于如何在Sublime Text 2,Windows 8中构建和运行c ++程序?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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