- Marcar como novo
- Marcador
- Subscrever
- Silenciar
- Subscrever fonte RSS
- Destacar
- Imprimir
- Denunciar conteúdo inapropriado
I hit an issue with the debugger - it gets confused about the line the source is in:
I know this happens when your build/pdb is out of date, this is not the case here. Instead it is related to a somewhat weird combination of #include (preprocessor) and include (Fortran).
To reproduce I have 4 files: 2 include files, one module and a main:
SomeFile.fi:
integer, parameter :: someval = 88
OtherFile.fi:
!#DEFINE BLA_BLA
#IF .NOT. DEFINED (BLA_BLA)
#DEFINE MyFun(a, b, c) .true.
#ELSE
USE, INTRINSIC :: ISO_C_BINDING, ONLY: C_LOC
#ENDIF
TestInclude.f90 (do not remove the empty line 14 for clarity):
module MTestInclude
#include "OtherFile.fi"
#IF DEFINED (SIGNAL_MEM_ARRS)
use NonExistantModule
#ENDIF
implicit none
save
contains
subroutine test()
include "SomeFile.fi"
write(*,*) someval
end subroutine test
end module MTestInclude
Console1.f90:
program main
use MTestInclude
call test()
end program main
It does not only offset the debugger in the function with the include, but also for other functions defined after that one in the same file. Interestingly it seems you need the combination of #include and include to break it.
So for me the simple workaround is to include "OtherFile.fi" instead of #include "OtherFile.fi", just thought it might be of interest. Or maybe there is something actually wrong with the #include version?
Link copiado
- Marcar como novo
- Marcador
- Subscrever
- Silenciar
- Subscrever fonte RSS
- Destacar
- Imprimir
- Denunciar conteúdo inapropriado
FWIW I use fpp and #include extensively in my solution, but I do not use "include". I do not have a line positioning error.
Note, if you are compiling with any optimizations enabled, you can(may) see such behavior.
Jim Dempsey
- Marcar como novo
- Marcador
- Subscrever
- Silenciar
- Subscrever fonte RSS
- Destacar
- Imprimir
- Denunciar conteúdo inapropriado
Thanks Jim. This is in a Debug build with no optimizations. But good point about only using #include: Another way to get it to work as it should.

- Subscrever fonte RSS
- Marcar tópico como novo
- Marcar tópico como lido
- Flutuar este Tópico para o utilizador atual
- Marcador
- Subscrever
- Página amigável para impressora