Vim尝试在:make之后跳转到不存在的文件

时间:2012-02-24 07:44:44

标签: vim gcc makefile

我正在使用:make中的vim并最终跳转到有问题的文件。

最近,至少我注意到gcc 4.6.1vim跳转到不正确的文件/行,因为它转到第一个报告的行"In file included from ABC.h|5| 0,"并且没有名为{{的文件1}}。

在这种情况下,有一个解决方案只能从上面的行"In file included from ABC.h"中提取文件名,但这并不能解决问题,因为有问题的文件只包含在那里。

通常下一行表示问题所在,这就是我想跳的地方:

ABC.h

MyDir/FGH.h|56 col 32| error: 'bad bad thing happened here' 中是否有针对此的已知修复程序?

3 个答案:

答案 0 :(得分:4)

这是在新版本的Vim上解决的错误:Bug report logs - #62169

您可以使用以下设置解决问题而无需升级Vim:

  set errorformat^=%-GIn\ file\ included\ from\ %f:%l:%c:,%-GIn\ file
           \\ included\ from\ %f:%l:%c\\,,%-GIn\ file\ included\ from\ %f
           \:%l:%c,%-GIn\ file\ included\ from\ %f:%l

(从最新的Vim源代码中提取的设置,来自文件src/option.h

答案 1 :(得分:3)

:make!没有跳到第一个结果。

答案 2 :(得分:1)

问题是最近版本的gcc所需的错误格式略有不同。

我相信这在前几天在C ++ Lounge(聊天)中被提及,并且发布了一个错误格式,据说效果更好。 我没有测试过它

  • http://chat.stackoverflow.com/search?q=errorformat&room=10

    errorformat=%*[^"]"%f"%*\D%l: %m,"%f"%*\D%l: %m,%-G%f:%l: (Each undeclared identifier is reported only once,%-G%f:%l: for each function it appears in.),%-GInfile included from %f:%l:%c:,%-GIn file included from %f:%l:%c\,,%-GIn file included from %f:%l:%c,%-GIn file included from %f:%l,%-G%*[ ]from %f:%l:%c,%-G%*[ ]from %f:%l:,%-G%*[ ]from %f:%l\,,%-G%*[ ]from %f:%l,%f:%l:%c:%m,%f(%l):%m,%f:%l:%m,"%f"\, line %l%*\D%c%*[^ ] %m,%D%*\a[%*\d]: Entering directory `%f',%X%*\a[%*\d]: Leaving directory `%f',%D%*\a: Entering directory `%f',%X%*\a: Leaving directory `%f',%DMaking %*\a in %f,%f|%l| %m
    
相关问题