Re: Strange compiler error -- GFortran thinks I haven't declared a variable.
- From: Daniel Carrera <daniel@xxxxxxxxx>
- Date: Mon, 31 Oct 2011 08:53:44 +0100
On 10/31/2011 08:22 AM, Louisa wrote:
Not really.
The messages produced by the compiler are nonsensical.
Indeed, they are, but they turned out to be not the compiler's fault. The text editor was showing me this:
! comment
real(wp) :: SD = ...
When in reality my file had this:
! comment real(wp) :: SD = ...
The compiler was effectively saying that SD wasn't declared, and of course it has no implicit type because my program is running under implicit none.
The OP might have obtained better feedback by using a decent compiler.
I use gfortran with "-Wall -fimplicit-none -std=2008 -fbounds-check". Is there a different compiler or flag that you think would have helped me in this case?
The compiler he used doesn't print the complete source line
in the event of an error.
Yes it did... It correctly detected that I was using a variable that was not declared (due to the buggy editor) and complained in the line where I tried to use it.
The OP might have found his error by reducing the problem
to the bare minimum, by first compiling the function by itself.
The OP tried that, but as you might imagine, every time he copied and pasted the offending function to a different file to make a test program the error went away.
I also tried retracing my steps, reviewing the changes I had done recently, trying to undo the recent changes, etc. You know, natural things you try when your program stops working.
It took a while before it occurred to me that the editor might be showing me something different from what is really in the file. The moment I tried using a different editor, the problem became clear.
Cheers,
Daniel.
.
- Follow-Ups:
- References:
- Strange compiler error -- GFortran thinks I haven't declared a variable.
- From: Daniel Carrera
- Re: Strange compiler error -- GFortran thinks I haven't declared a variable.
- From: Louisa
- Re: Strange compiler error -- GFortran thinks I haven't declared a variable.
- From: Richard Maine
- Re: Strange compiler error -- GFortran thinks I haven't declared a variable.
- From: Louisa
- Strange compiler error -- GFortran thinks I haven't declared a variable.
- Prev by Date: Re: is real*8 a standard declaration style?
- Next by Date: Re: Strange compiler error -- GFortran thinks I haven't declared a variable.
- Previous by thread: Re: Strange compiler error -- GFortran thinks I haven't declared a variable.
- Next by thread: Re: Strange compiler error -- GFortran thinks I haven't declared a variable.
- Index(es):
Relevant Pages
|