使用minGW获取Notepad ++来编译和运行C ++程序 [英] Getting Notepad++ to compile and run C++ programs using minGW

查看:141
本文介绍了使用minGW获取Notepad ++来编译和运行C ++程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我下载了minGW以使用Notepad ++控制台中的gcc命令在C中编译程序.我下载了所有软件包,以便它也可以编译其他语言,并且再次检查我是否具有g ++.exe,就像我具有gcc.exe来编译c程序一样.但是我不知道如何编译和运行c ++程序.我看到了另一篇文章让编译器在记事本中工作",以及他如何复制和粘贴:

I downloaded minGW to compile programs in C using the gcc command in the console of Notepad++. I downloaded all the packages so that it could compile other languages as well and I double checked that I have g++.exe just like I have gcc.exe to compile c programs. But I don't get how to get to compile and run c++ programs. I saw the other post, "Getting compiler to work in Notepad", and how he copied and pasted:

NPP_SAVE
CD $(CURRENT_DIRECTORY)
C:\MinGW\bin\g++.exe -g "$(FILE_NAME)"

进入nppExec控制台.当我这样做时,我得到:

into the nppExec console. When I do that I get:

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 ================

似乎可行,但接下来我该怎么做?

which seems like it works but what do I do next?

这是记事本++中的程序

here is the program in notepad++

#include <iostream> 

using namespace std; 

int main() {

cout << "Hello World";

}

推荐答案

说实话,我之前没有尝试过nppExec插件. (我通常使用IDE.)但这是有根据的猜测:

To be honest I have not tried the nppExec plugin before. (I usually use IDE.) But here is an educated guess:

您键入的内容使代码得以编译,但没有执行生成的可执行文件.您需要指定输出文件,然后运行它.将会是这样的:

What you typed in made the code compile, but did not execute the resulting executable. You need to specify the output file, and the run it. It is going to be something like this:

NPP_SAVE
CD $(CURRENT_DIRECTORY)
C:\MinGW\bin\g++.exe -g "$(FILE_NAME)" -o prog.exe
prog.exe

这篇关于使用minGW获取Notepad ++来编译和运行C ++程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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