欢迎各位兄弟 发布技术文章
这里的技术是共享的
1. 打开菜单 Plugins -> NppExec -> Execute...。
2. 配置编译C文件。
进入“Execute...” 对话框,输入 cmd /c "gcc -o $(CURRENT_DIRECTORY)$(NAME_PART) $(FULL_CURRENT_PATH) ",点击“Save...”按钮保存,命名为“CompileC”。
3. 配置编译C++文件。
进入“Execute...” 对话框,输入 cmd /c "g++ -o $(CURRENT_DIRECTORY)$(NAME_PART) $(FULL_CURRENT_PATH) ",点击“Save...”按钮保存,命名为“CompileC++”。
4、将“CompileC”,“CompileC++”添加到宏菜单(Macros)下。
1)打开菜单 Plugins -> NppExec ->Advanced Options...。
2)在Associated script:下面下拉框中选择“CompileC”,“CompileC++”,点击“Add/Modify”按钮将它们依次添加到Menu items下面的列表中。
选择 "Place to the Macros submenu"复选框。
3)打开菜单 Macro ,可以看到“CompileC”,“CompileC++”都已经添加到宏菜单(Macros)下。
5、编译C语言helloworld程序 。
1)输入helloworld.c 的源代码:#include <stdio.h>
void print() {
printf ("Hello World!\n");
}
main() {
print();
return 0;
}
2)点击菜单 Macro -> CompileC,执行效果如下图所示。
在与helloworld.c 相同的目录下生成了一个 hellowrold.exe 文件。说明:如果编译的 *.c文件的路径中包含了空格,在执行“Compile C”命令时将报错。