CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   Main CFD Forum (https://www.cfd-online.com/Forums/main/)
-   -   Fortran Compiler error. (https://www.cfd-online.com/Forums/main/10148-fortran-compiler-error.html)

John. October 24, 2005 09:20

Fortran Compiler error.
 
Hi,

I am doing a simulation using a Fortran code where I need to calculate the error function. I use the DERFC function. When I call it, I get the following errors:

Error 220 at (192:A.F) : This entity has not been given a type

^ Error 166 at (192:A.F) : Type conformance violation on assignment

When I get rid of the 'implicit none' command from the Fortran code, it compiles and works fine. Does anyone know what my problem is?

Regards,

John.

andy October 24, 2005 12:13

Re: Fortran Compiler error.
 
You have not declared the type of something on line 192 (if that is what 192:A.F means). At a guess it is the type of your external function but you have not provided much to go on.


Vinod Dhiman October 24, 2005 14:05

Re: Fortran Compiler error.
 
Hi

Yes, Andy is right. You have not declared that particular entity, which it shows in error. You have to declare it. When you switch off IMPLICIT NONE it takes it as real or integer according to whether that particular variable starts with any character from I to N or any other else, and does the function. So, look out for that variable, then see whether its global or local, and accordingly declare it at the proper position.

Vinod Dhiman

John. October 25, 2005 05:13

Re: Fortran Compiler error.
 
Hi guys,

Thank you borh for your comments. The function is built into fortran though, it is called DERFC and calculates the error function. I don't understand why I need to declare it if it is a function which Fortran has internally.

Thanks.

andy October 25, 2005 05:32

Re: Fortran Compiler error.
 
Unless you check the other variables on the line in question we do not know that it is the function derfc that has not been declared.

Of course, RTFM will tell you but one thought strikes me: the fortran language will expect you to use the generic function erfc rather than the specific function derfc and omitting the specific declarations would be a good way to indicate this to users.


John. October 25, 2005 14:18

Re: Fortran Compiler error.
 
Hi Andy,

I have narrowed the problem down to the DERFC command, I know it is not other variables on the line in question. I woul dnot post a question unless I had established this.

John.

Jeff Moder October 25, 2005 17:04

Re: Fortran Compiler error.
 
Is this the GNU intrinsic defined below ?

DErFC: REAL(KIND=2) function.

X: REAL(KIND=2); scalar; INTENT(IN).

Maybe the KIND of the argument you are passing to DERFC (such as DERFC(x)) is not kind(x)=2. You could check this, or you could just use ERFC:

ErFC: REAL function, the `KIND=' value of the type being that of argument X.

X: REAL; scalar; INTENT(IN).


Mani October 25, 2005 20:20

Re: Fortran Compiler error.
 
Can you show us the line of code in question? What does the argument to the function look like, and of what type is the argument? It is important that the argument be of the correct type, and that all argument types (if more than one argument) match, for the specific function.Some compilers may take care of mismatches by type conversion, or simply won't report it, but you should prefer the "picky" compiler that actually tells you that something is wrong here.

As a side note, I don't think the error function erfc is part of the FORTRAN standard (which is not a problem, unless you want your code to be portable.)


All times are GMT -4. The time now is 13:50.