【发布时间】:2015-03-23 18:05:15
【问题描述】:
我下载了 minGW 以使用 Notepad++ 控制台中的 gcc 命令在 C 中编译程序。我下载了所有软件包,以便它也可以编译其他语言,并且我仔细检查了我有 g++.exe,就像我有 gcc.exe 来编译 c 程序一样。但我不知道如何编译和运行 c++ 程序。我看到了另一篇文章“让编译器在记事本中工作”,以及他是如何复制和粘贴的:
NPP_SAVE
CD $(CURRENT_DIRECTORY)
C:\MinGW\bin\g++.exe -g "$(FILE_NAME)"
进入 nppExec 控制台。当我这样做时,我得到:
NPP_SAVE: C:\Tutorial\helloWorld.cpp
CD: C:\Tutorial
Current directory: C:\Tutorial
C:\MinGW\bin\g++.exe -g "helloWorld.cpp"
Process started >>>
<<< Process finished. (Exit code 0)
================ READY ================
这似乎可行,但接下来我该怎么做?
这是notepad++中的程序
#include <iostream>
using namespace std;
int main() {
cout << "Hello World";
}
【问题讨论】:
-
如果您希望能够编译/运行/调试等,最好使用 IDE 而不是 Notepad++。Dev-C++(也使用 g++)和Visual Studio Express(免费版本Visual Studio 的)是选项。
-
好的,谢谢您的回复。我只是希望能够编译和运行,我已经经历了下载 minGW 的麻烦,因为它编译多种语言,所以我只想使用它。