【发布时间】:2014-07-21 02:48:58
【问题描述】:
我在使用 Notepad++ 编译代码时遇到了一些问题。我已经安装了notepad++(和NppExec),从这个来源(http://nuwen.net/mingw.html)下载了MinGW,并将它安装到“C:\MinGW\”。
然后我尝试将notepad++设置为使用g++编译c++。根据建议,我在 NppExec 的控制台中输入了以下内容:
NPP_SAVE
CD $(CURRENT_DIRECTORY)
C:\MinGW\bin\g++.exe -g "$(FILE_NAME)"
将其保存为 C++ 编译器,并将其添加到工具栏的“宏”部分。
然后我尝试运行一个简单的测试程序:
#include <iostream>
int main()
{
cout << "Hello, world!";
}
之后出现了几个奇怪的错误。首先它希望我默认保存到 System32,我不记得它以前做过(它不会让我,强迫我保存在 Documents 中)。
我让它保存到文档中,而不是尝试用编译器运行它。它给了我这个错误,我根本不认识:
NPP_EXEC: "C++ Compiler"
NPP_SAVE: C:\Users\Bova\Documents\Test.cpp
CD: C:\Users\Bova\Documents
Current directory: C:\Users\Bova\Documents
C:\MinGW\bin\g++.exe -g "Test.cpp"
Process started >>>
Test.cpp: In function 'int main()':
Test.cpp:5:5: error: 'cout' was not declared in this scope
cout << "Hello, world!";
^
Test.cpp:5:5: note: suggested alternative:
In file included from Test.cpp:1:0:
c:\mingw\include\c++\4.8.2\iostream:61:18: note: 'std::cout'
extern ostream cout; /// Linked to standard output
^
<<< Process finished. (Exit code 1)
请帮忙。
【问题讨论】: