我在没有IDE的计算机上构建一些相当大的代码,但是使用Notepad ++。
编译结果被重定向到文件,有时会出现错误消息,这些消息满足定义良好的正则表达式。
我想知道NPP是否有一个插件,它会解析日志文件,识别错误/警告消息并让我在相应的错误/警告位置之间导航。
修改
以下是输出的典型示例(由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
答案 0 :(得分:7)
由于您已将所有输出保存在日志文件中,DeusAphor建议的是我也会这样做。
另一个选择是让编译器输出正常导入NppExec的控制台,然后设置NppExec打开冒犯的源文件并跳转到编译器指定的行。
这可以通过首先注意编译器发出的错误消息的模式,然后打开对话框来实现:插件 - > NppExec->控制台输出过滤器 - > [突出显示]选项卡。插件识别的变量的快速示例显示在该选项卡中。
例如,对于mingw32 GCC,输出控制台上会显示错误消息,其格式如下:
文件: LINE :some_other_num:错误类型:error_desription
因此,在对话框的[突出显示]选项卡中,您可以使用通配符语法将其添加到第一个文本框中,如下图所示(查看顶行):
(您可能需要将%FILE%替换为%ABSFILE%,具体取决于您的编译器和/或Windows版本)
不要忘记在文本框前面启用复选标记(您也可以从文本框旁边的选项中定义一些颜色和/或文本样式)。
在关闭NppExec对话框之前,请转到 [替换]标签并启用顶部的选项:“启用替换过滤器”。
最后,单击确定关闭NppExec对话框,确保菜单项* 插件 - > NppExec->控制台输出过滤器选中。如果没有,请检查它。
如果一切顺利,您现在应该能够双击NppExec输出控制台上显示的任何错误消息,让它打开相关文件并将光标移动到指示的行。
另一种选择是在Windows命令提示符下安装替代终端,例如MSYS,它可以是嵌入式的,也可以作为mingw tool-chain的独立下载。
但是,它需要熟悉类Unix的shell实用程序,还需要编写自己的Np ++或NppExec脚本。 This post可能有用,但它讨论了Cygwin(顶级Windows上的Unix分层环境)。
答案 1 :(得分:1)
好吧,我要做的就是使用“在文件中查找” ...
鉴于你当前的例子我只是把文字发现为“错误”;如果你想包括警告;启用正则表达式并搜索“错误|警告”
目录当然是要搜索的目录..
使用过滤器,您可以告诉它只查看具有X名称的文件。 示例:“compiler-output3844.txt”您将使用“compiler-output * .txt”
这会给你这样的东西......