gfortran编译器的Vim错误格式
我正在使用vimgfortran编译器的Vim错误格式,vim,makefile,fortran,Vim,Makefile,Fortran,我正在使用vim:make使用gfortran编译FORTRAN代码。我喜欢quickfix窗口在编译错误之间切换的功能。我正在使用建议用于gfortran的errorformat,即: errorformat=%E%f:%l.%c:,%E%f:%l:,%C,%C%p%*[0123456789^],%ZError: %m,%C%.%# 它可以检测大部分错误。我想增加处理以下问题的可能性 警告 链接器错误 (额外)涉及两个位置的错误:(1)和(2) 不久前,当我试图为英特尔FORTRAN编写
:make
使用gfortran编译FORTRAN代码。我喜欢quickfix窗口在编译错误之间切换的功能。我正在使用建议用于gfortran的errorformat,即:
errorformat=%E%f:%l.%c:,%E%f:%l:,%C,%C%p%*[0123456789^],%ZError: %m,%C%.%#
它可以检测大部分错误。我想增加处理以下问题的可能性
- 警告
- 链接器错误
- (额外)涉及两个位置的错误:(1)和(2)
folder/file.f90:485.12:
use SomeMod, only: somevar
1
Warning: Unused module variable 'somevar' which has been explicitly imported at (1)
/tmp/ccPcF56y.o: In function `MAIN__':
test.f90:(.text+0x8e0): undefined reference to `init_'
../../_build/amod.o: In function `__amod_MOD_dostuff':
amod.f90:(.text+0x3e32): undefined reference to `dothis_'
amod.f90:(.text+0x3e74): undefined reference to `dothat_'
collect2: error: ld returned 1 exit status
file.f90:8.8:
use AMod
1
file.f90:231.25:
call init()
2
Error: 'init' at (1) has a type, which is not consistent with the CALL at (2)
链接器错误示例
folder/file.f90:485.12:
use SomeMod, only: somevar
1
Warning: Unused module variable 'somevar' which has been explicitly imported at (1)
/tmp/ccPcF56y.o: In function `MAIN__':
test.f90:(.text+0x8e0): undefined reference to `init_'
../../_build/amod.o: In function `__amod_MOD_dostuff':
amod.f90:(.text+0x3e32): undefined reference to `dothis_'
amod.f90:(.text+0x3e74): undefined reference to `dothat_'
collect2: error: ld returned 1 exit status
file.f90:8.8:
use AMod
1
file.f90:231.25:
call init()
2
Error: 'init' at (1) has a type, which is not consistent with the CALL at (2)
多个错误位置示例
folder/file.f90:485.12:
use SomeMod, only: somevar
1
Warning: Unused module variable 'somevar' which has been explicitly imported at (1)
/tmp/ccPcF56y.o: In function `MAIN__':
test.f90:(.text+0x8e0): undefined reference to `init_'
../../_build/amod.o: In function `__amod_MOD_dostuff':
amod.f90:(.text+0x3e32): undefined reference to `dothis_'
amod.f90:(.text+0x3e74): undefined reference to `dothat_'
collect2: error: ld returned 1 exit status
file.f90:8.8:
use AMod
1
file.f90:231.25:
call init()
2
Error: 'init' at (1) has a type, which is not consistent with the CALL at (2)
这就是我取得的成绩,这是一种工作,但不是很好
set efm=%I%.%#In\ function%m,%I%.%#undefined\ reference\ to%m,%E%f:%l.%c:,%E%f:%l:,%C,%C%p%*[0123456789^],%ZError:\ %m,%ZWarning:\ %m,%C%.%#
这在某种程度上是可行的
set efm=%A%f:%l.%c:,%C,%C\ %.%#,%ZError:\ %m,%ZWarning:\ %m,%f:(%.%#):%m
- 多行部件(%A-%Z)以同等的方式处理错误和警告
- %C代码用于跳过空行和以空白开头的行
- 链接错误格式不会将您带到调用缺少的函数的行,但会打开正确的文件
- 我不知道如何使用vim errorformat处理多个错误案例
:clist
1 folder/file.f90:22 col 19: Symbol 'ini' at (1) has no IMPLICIT type
2 folder/file.f90:485 col 12: Unused module variable 'somevar' which has been explicitly imported at (1)
4 test.f90: undefined reference to `init_'
6 amod.f90: undefined reference to `dothis_'
7 amod.f90: undefined reference to `dothat_'
非常感谢,如果使用调试标志(在这种情况下,行号是已知的),则未定义的引用似乎有所不同。将以下内容添加到您的列表将同时考虑这两个因素:%f:%l:%m