Notepad ++,NppExec,CreateProcess()失败,错误代码2,Windows 8.1

时间:2014-02-03 09:04:23

标签: c++ compiler-construction notepad++ nppexec

我是Notepad ++和C ++编程语言的新手。我无法弄清楚出了什么问题,尽管对许多人来说可能看起来很简单。 试图寻找解决方案,但无济于事。 在Windows 8.1上尝试为C ++编译器配置应用程序时,我遇到了以下消息。

NPP_SAVE: C:\Users\rolle_000\Desktop\HelloWorld.cpp
CD: C:\Users\rolle_000\Desktop
Current directory: C:\Users\rolle_000\Desktop
Compiled.exe -c -w "HelloWorld.cpp"
CreateProcess() failed with error code 2:
The system cannot find the file specified.

================ READY ================

C ++基本代码,仅适用于测试。

// A hello world program in C++

#include<iostream>
using namespace std;

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

NppExec脚本取自

How to compile and run C files from within Notepad++ using NppExec plugin? 在嵌入式矿井下,脚本没有太大变化。

NPP_SAVE
CD $(CURRENT_DIRECTORY)
Compiled.exe -c -w "$(FILE_NAME)"

请指教,谢谢。

1 个答案:

答案 0 :(得分:1)

您正在尝试执行

Compiled.exe

确实不存在(还)而不是

perl.exe -c -w "$(FILE_NAME)"

perl.exe是perl的可执行文件,应该与perl的程序一起使用。 要编译C ++程序,您需要使用C ++编译器

现在:这一切都归结为你想要使用的编译器......你要使用哪一个? MSVC(Microsoft Visual Studio)?流血的开发者?

示例:如果安装了MSVC2010,则可以使用:

  1. 执行Start->All Programs->Microsoft Visual Studio 2010->Visual Studio Tools->Visual Studio Command Prompt (2010)

  2. 数字cl (yourFileName).cpp

  3. 您已完成,yourFileName.exe现在应该存在

  4. 所以上面的内容必须改写为:

    cl.exe "$(FILE_NAME)"
    

    确保cl.exe的路径正确可用后。

相关问题