可以记事本+ +被配置为识别编译器错误消息并跳转到相应的位置?(Can Notepad++ be c

2019-08-04 05:52发布

我建立一个机器上的一些相当大的代码没有一个IDE,但用记事本++。

编译结果被重定向到一个文件,有时,有错误消息,其满足一个良好定义的正则表达式。

我不知道如果NPP有一个插件,它会分析日志文件,认识到错误/警告messagess,让我相应的错误/警告位置之间进行导航。

编辑

下面是输出(由make产生运行MSVC cl.exe时编译器)的一个典型的例子:

/cygdrive/c/vs2010/VC/Bin/cl   -Zi -nologo -MD /D _STATIC_CPPLIB  -FdC:/openjdk/OUTPUT~1/tmp/sun/sun.awt/awt/obj/Win32SurfaceData.pdb -FmC:/openjdk/OUTPUT~1/tmp/sun/sun.awt/awt/obj/Win32SurfaceData.map -W3 -DD3D_OVERLOADS  -DUNICODE -D_UNICODE  -DWIN32 -DIAL -D_LITTLE_ENDIAN -DWIN32 -D_X86_ -Dx86  -DWIN32_LEAN_AND_MEAN -I. -IC:/openjdk/OUTPUT~1/tmp/sun/sun.awt/awt/CClassHeaders -I../../../src/windows/javavm/export -I../../../src/share/javavm/export -I../../../src/share/javavm/include -I../../../src/windows/javavm/include -I../../../src/share/native/common -I../../../src/windows/native/common -I../../../src/share/native/sun/awt -I../../../src/windows/native/sun/awt -IC:/openjdk/OUTPUT~1/tmp/sun/sun.awt/awt/CClassHeaders/../../java/jvm -IC:/openjdk/OUTPUT~1/tmp/sun/sun.awt/awt/obj -I../../../src/share/native/common -I../../../src/windows/native/sun/windows -IC:/PROGRA~2/MICROS~1/Include -I../../../src/share/native/sun/awt/image/cvutils -I../../../src/share/native/sun/awt/image -I../../../src/share/native/sun/java2d/loops -I../../../src/share/native/sun/java2d -I../../../src/windows/native/sun/java2d -I../../../src/share/native/sun/java2d/opengl -I../../../src/windows/native/sun/java2d/d3d -I../../../src/windows/native/sun/java2d/opengl -I../../../src/windows/native/sun/java2d/windows -I../../../src/share/native/sun/font -I../../../src/share/native/sun/java2d/pipe -I../../../src/share/native/sun/dc/path -I../../../src/share/native/sun/dc/doe -I../../../src/share/native/sun/awt/debug -I../../../src/windows/native/sun/awt  -I../../../src/share/native/sun/awt/medialib   -DINTERNAL_BUILD  -c -FoC:/openjdk/OUTPUT~1/tmp/sun/sun.awt/awt/obj/Win32SurfaceData.obj  ../../../src/windows/native/sun/awt/../java2d/windows/Win32SurfaceData.cpp
Win32SurfaceData.cpp
../../../src/windows/native/sun/awt/../java2d/windows/Win32SurfaceData.cpp(478) : warning C4530: C++ exception handler used, but unwind semantics are not enabled. Specify /EHsc
/cygdrive/c/vs2010/VC/Bin/cl   -Zi -nologo -MD /D _STATIC_CPPLIB  -FdC:/openjdk/OUTPUT~1/tmp/sun/sun.awt/awt/obj/WinBackBufferSurfaceData.pdb -FmC:/openjdk/OUTPUT~1/tmp/sun/sun.awt/awt/obj/WinBackBufferSurfaceData.map -W3 -DD3D_OVERLOADS  -DUNICODE -D_UNICODE  -DWIN32 -DIAL -D_LITTLE_ENDIAN -DWIN32 -D_X86_ -Dx86  -DWIN32_LEAN_AND_MEAN -I. -IC:/openjdk/OUTPUT~1/tmp/sun/sun.awt/awt/CClassHeaders -I../../../src/windows/javavm/export -I../../../src/share/javavm/export -I../../../src/share/javavm/include -I../../../src/windows/javavm/include -I../../../src/share/native/common -I../../../src/windows/native/common -I../../../src/share/native/sun/awt -I../../../src/windows/native/sun/awt -IC:/openjdk/OUTPUT~1/tmp/sun/sun.awt/awt/CClassHeaders/../../java/jvm -IC:/openjdk/OUTPUT~1/tmp/sun/sun.awt/awt/obj -I../../../src/share/native/common -I../../../src/windows/native/sun/windows -IC:/PROGRA~2/MICROS~1/Include -I../../../src/share/native/sun/awt/image/cvutils -I../../../src/share/native/sun/awt/image -I../../../src/share/native/sun/java2d/loops -I../../../src/share/native/sun/java2d -I../../../src/windows/native/sun/java2d -I../../../src/share/native/sun/java2d/opengl -I../../../src/windows/native/sun/java2d/d3d -I../../../src/windows/native/sun/java2d/opengl -I../../../src/windows/native/sun/java2d/windows -I../../../src/share/native/sun/font -I../../../src/share/native/sun/java2d/pipe -I../../../src/share/native/sun/dc/path -I../../../src/share/native/sun/dc/doe -I../../../src/share/native/sun/awt/debug -I../../../src/windows/native/sun/awt  -I../../../src/share/native/sun/awt/medialib   -DINTERNAL_BUILD  -c -FoC:/openjdk/OUTPUT~1/tmp/sun/sun.awt/awt/obj/WinBackBufferSurfaceData.obj  ../../../src/windows/native/sun/awt/../java2d/windows/WinBackBufferSurfaceData.cpp
WinBackBufferSurfaceData.cpp
/cygdrive/c/vs2010/VC/Bin/cl   -Zi -nologo -MD /D _STATIC_CPPLIB  -FdC:/openjdk/OUTPUT~1/tmp/sun/sun.awt/awt/obj/WBufferStrategy.pdb -FmC:/openjdk/OUTPUT~1/tmp/sun/sun.awt/awt/obj/WBufferStrategy.map -W3 -DD3D_OVERLOADS  -DUNICODE -D_UNICODE  -DWIN32 -DIAL -D_LITTLE_ENDIAN -DWIN32 -D_X86_ -Dx86  -DWIN32_LEAN_AND_MEAN -I. -IC:/openjdk/OUTPUT~1/tmp/sun/sun.awt/awt/CClassHeaders -I../../../src/windows/javavm/export -I../../../src/share/javavm/export -I../../../src/share/javavm/include -I../../../src/windows/javavm/include -I../../../src/share/native/common -I../../../src/windows/native/common -I../../../src/share/native/sun/awt -I../../../src/windows/native/sun/awt -IC:/openjdk/OUTPUT~1/tmp/sun/sun.awt/awt/CClassHeaders/../../java/jvm -IC:/openjdk/OUTPUT~1/tmp/sun/sun.awt/awt/obj -I../../../src/share/native/common -I../../../src/windows/native/sun/windows -IC:/PROGRA~2/MICROS~1/Include -I../../../src/share/native/sun/awt/image/cvutils -I../../../src/share/native/sun/awt/image -I../../../src/share/native/sun/java2d/loops -I../../../src/share/native/sun/java2d -I../../../src/windows/native/sun/java2d -I../../../src/share/native/sun/java2d/opengl -I../../../src/windows/native/sun/java2d/d3d -I../../../src/windows/native/sun/java2d/opengl -I../../../src/windows/native/sun/java2d/windows -I../../../src/share/native/sun/font -I../../../src/share/native/sun/java2d/pipe -I../../../src/share/native/sun/dc/path -I../../../src/share/native/sun/dc/doe -I../../../src/share/native/sun/awt/debug -I../../../src/windows/native/sun/awt  -I../../../src/share/native/sun/awt/medialib   -DINTERNAL_BUILD  -c -FoC:/openjdk/OUTPUT~1/tmp/sun/sun.awt/awt/obj/WBufferStrategy.obj  ../../../src/windows/native/sun/windows/WBufferStrategy.cpp
WBufferStrategy.cpp
/cygdrive/c/vs2010/VC/Bin/cl   -Zi -nologo -MD /D _STATIC_CPPLIB  -FdC:/openjdk/OUTPUT~1/tmp/sun/sun.awt/awt/obj/WPrinterJob.pdb -FmC:/openjdk/OUTPUT~1/tmp/sun/sun.awt/awt/obj/WPrinterJob.map -W3 -DD3D_OVERLOADS  -DUNICODE -D_UNICODE  -DWIN32 -DIAL -D_LITTLE_ENDIAN -DWIN32 -D_X86_ -Dx86  -DWIN32_LEAN_AND_MEAN -I. -IC:/openjdk/OUTPUT~1/tmp/sun/sun.awt/awt/CClassHeaders -I../../../src/windows/javavm/export -I../../../src/share/javavm/export -I../../../src/share/javavm/include -I../../../src/windows/javavm/include -I../../../src/share/native/common -I../../../src/windows/native/common -I../../../src/share/native/sun/awt -I../../../src/windows/native/sun/awt -IC:/openjdk/OUTPUT~1/tmp/sun/sun.awt/awt/CClassHeaders/../../java/jvm -IC:/openjdk/OUTPUT~1/tmp/sun/sun.awt/awt/obj -I../../../src/share/native/common -I../../../src/windows/native/sun/windows -IC:/PROGRA~2/MICROS~1/Include -I../../../src/share/native/sun/awt/image/cvutils -I../../../src/share/native/sun/awt/image -I../../../src/share/native/sun/java2d/loops -I../../../src/share/native/sun/java2d -I../../../src/windows/native/sun/java2d -I../../../src/share/native/sun/java2d/opengl -I../../../src/windows/native/sun/java2d/d3d -I../../../src/windows/native/sun/java2d/opengl -I../../../src/windows/native/sun/java2d/windows -I../../../src/share/native/sun/font -I../../../src/share/native/sun/java2d/pipe -I../../../src/share/native/sun/dc/path -I../../../src/share/native/sun/dc/doe -I../../../src/share/native/sun/awt/debug -I../../../src/windows/native/sun/awt  -I../../../src/share/native/sun/awt/medialib   -DINTERNAL_BUILD  -c -FoC:/openjdk/OUTPUT~1/tmp/sun/sun.awt/awt/obj/WPrinterJob.obj  ../../../src/windows/native/sun/windows/WPrinterJob.cpp
WPrinterJob.cpp
../../../src/windows/native/sun/windows/WPrinterJob.cpp(74) : warning C4530: C++ exception handler used, but unwind semantics are not enabled. Specify /EHsc
../../../src/windows/native/sun/windows/WPrinterJob.cpp(117) : error C2664: 'JNIEnv_::NewString' : cannot convert parameter 1 from 'LPWSTR' to 'const jchar *'
        Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast
../../../src/windows/native/sun/windows/WPrinterJob.cpp(142) : error C2664: 'JNIEnv_::NewString' : cannot convert parameter 1 from 'LPTSTR' to 'const jchar *'
        Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast

Answer 1:

既然你有保存在一个日志文件中所有的输出,什么DeusAphor建议是我也是会做。

另一种选择是让编译器直接输出通常本身进入NppExec的控制台,然后设置NppExec打开冒犯源文件,并跳转到编译器所规定的线。

这可以通过首先发现错误消息的图案来实现发射由你的编译器,然后打开对话框: 插件- > NppExec->控制台输出过滤器- > [高]标签 。 通过插件识别的变量的快速样品都该选项卡中。

对于mingw32的GCC,例如,错误消息显示用下面的图案在输出控制台:

FILE:LINE:some_other_num: 错误类型:error_desription

因此,该对话框的[高亮]标签内,可以用一个通配符语法到第一文本框添加它,如图下面的图片(看顶行):

您可能需要使用%ABSFILE%来代替%FILE%,这取决于你的编译器和/或Windows版本

不要忘记,以使在文本框前面的复选标记 (你也可以定义一些颜色和/或文本样式,从明年提交文本框的选项)。

现在关闭NppExec对话框之前,去它的[替换]选项卡并启用顶部的选项:“启用更换过滤器”。

最后,确定关闭对话框NppExec并确保该菜单项*插件- > NppExec->控制台输出筛选检查 。 如果没有,检查它。

如果一切顺利,您现在应该能够双击到NppExec的输出控制台上显示的错误信息,有它打开相对文件,并把光标移动到指定的行。

另一种选择是可替换的终端安装到Windows命令提示,如MSYS例如自带嵌入或作为一个独立的下载的mingw工具链 。

但是,它需要用的类Unix shell实用程序的熟悉和涉及也写自己的Np个++或NppExec脚本。 这篇文章可能是为出发点有用的,尽管它探讨了Cygwin的(在上面的Windows在Unix层次的环境)。



Answer 2:

好了,所以我会做的是使用“查找文件” ...

鉴于当前的例子中,我只是把文字作为寻找“错误”; 如果你想包括警告; 使正则表达式,然后搜索“错误|警告”

目录当然是搜索的目录..

使用过滤器,你可以告诉它只能看与X名的文件。 例如:“编译器output3844.txt”你可以使用“编译器输出* .TXT”

这会给你的东西是这样的...



文章来源: Can Notepad++ be configured to recognize compiler error messages and jump to the respective location?
标签: ide notepad++