gpt4 book ai didi

c++ - 如何在 Sublime Text 2、Windows 8 中构建和运行 C++ 程序?

转载 作者:可可西里 更新时间:2023-11-01 15:07:56 25 4
gpt4 key购买 nike

我用 mingw 安装了 Codeblocks,选择了默认编译器,可以构建和运行一个简单的 hello 程序而不会出错。

我安装了 Sublime Text 2,复制粘贴了相同的 hello world 程序:

// my first program in C++
#include <iostream>

using namespace std;

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

构建时,我收到错误消息:

[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]

要使用 Sublime Text 2 构建和运行简单程序,我需要做什么?

最佳答案

首先,确保在构建和运行之前保存您正在处理的文件,将其保存在驱动器上的任何位置。

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

http://mjiang.com/mec/cs244/files/Installing%20c++_g++_on_Windows.pdf

关于c++ - 如何在 Sublime Text 2、Windows 8 中构建和运行 C++ 程序?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13145684/

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