I'm using :make
from vim
and ending up jumping to the file with issues.
Recently, at least I noticed with gcc 4.6.1
, vim
jumps to incorrect file/line because it goes to the first reported line which has "In file included from ABC.h|5| 0,"
and there is no file called "In file included from ABC.h"
.
There is a solution to extract just the file name from the above line, ABC.h
in this case, but that does not solve the problem as the problematic file is only included there.
Usually the next line indicates where the issue is and that's where I would like to jump:
MyDir/FGH.h|56 col 32| error: 'bad bad thing happened here'
Is there a known fix for this in vim
?
This a bug that is solved on new versions of Vim: Bug report logs - #62169.
You can use the following setting to solve the problem without upgrading 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
(setting extracted from latest Vim source code, from file src/option.h)
:make!
doesn't jump to the first result.
The problem is with slight differences in the errorformat required for recent versions of gcc.
I believe this was mentioned in C++ Lounge (chat) the other day, and an errorformat was posted that supposedly works better. I haven't tested that it does:
https://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
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With