What is the cause of these error- symbol 'x1' has no implicit type?

In summary: This thread was used to communicate with the user interface. When the user interface changed, the thread was no longer needed and the system crashed. Microsoft was able to fix the problem by making the change to the threading model. In summary, the bug was caused by changing the type of a variable in a subroutine and caused 60,000 programs to have errors.
  • #1
s_hy
61
0
Hi all,

i am beginner in fortran and linux. I have wrote codes for 1d scalar wave as below:

SUBROUTINE fd1d (x_num,x1,x2,t_num,t1,t2,c,u_x1,u_x2,u_t1,ut_t1,u)
implicit none
integer (kind=2) t_num,x_num,t,x
real (kind=4) alpha,c,t_delta,t1,t2,u(t_num+1,x_num+1),ut(x_num+1),x_delta,x1,x2
t_delta = (t2-t1)/real(t_num,kind=4)
x_delta = (x2-x1)/real(x_num,kind=4)
alpha = c*t_delta/x_delta
write ( *,'(a)')''
write ( *,'a,g14.6)') 'Stability condition ALPHA = C * DT/DX = ',alpha
Open (103, FILE='parameters.DAT',status='old')
Open(90, File = "abc.dat", ACCESS = 'APPEND')

!the boundary conditions
call u_x1 ( t_num,x_num,u )
call u_x2 ( t_num,x_num,u )

!the initial data
call u_t1 ( t_num,x_num,u )
call ut_t1( x_num,ut )

t=1
do x=2, x_num
u(t+1,x) = alpha**2 * u(t,x+1) / 2.0D+00 + ( 1.0D+00-alpha**2 ) * u(t,x) &
+ alpha**2 * u(t,x-1) / 2.0D+00 + t_delta * ut(x)
end do

!All subsequent steps in time rely on two previous rows of solution data

do t=2, t_num
do x=2, x_num
u(t+1,x) = alpha**2 * u(t, x+1) + 2.0D+00 * (1.0D+00-alpha**2) * u(t, x) &
+ alpha**2 * u(t, x-1) - u(t-1,x)
end do
end do
return
end SUBROUTINE fd1d


when i am trying to compile, there are errors referring to all parameters which is "symbol 'x1' (and t1, c, x2...) has no implicit type. What is that mean?
 
Technology news on Phys.org
  • #2
The variables that you list (x1, t1, c, and x2) are declared in the subroutine you showed, so my guess is that the error arises in some other part of your program, a part you didn't show us. Are these variables being used elsewhere in your program? If so, they probably aren't being declared in those places.

What we aren't seeing is the main program and the four subroutines that are called in the code above, plus whatever else makes up the entire program.

The compiler or linker probably gave more information than you showed, such as the line number at which the error occurred. That information can help you narrow down the source of the problem.
 
  • #3
thank you for ur time mark44. the list of subroutines that i didn't list here are quite long, might be bothering. I have found out the problem and finally have succeed to compile it without any error.

thanks again
 
  • #4
Hi guys,

Mark44 said:
The variables that you list (x1, t1, c, and x2) are declared in the subroutine you showed, so my guess is that the error arises in some other part of your program, a part you didn't show us.

The variables were re declared in the subroutine after being passed from the main program.

s_hy, see what happens when you change types between the main and the subroutine for future reference.

The windows wobble bug was similar and caused approx 60,000 programs to have errors when run in win 2000 (NT). The win com/com+ model created an extra thread on early dual processor systems that ran out after 8 ocurrences of a subroutine type change error.
 
Last edited:
  • #5


The cause of this error is that the variables x1, t1, c, and x2 have not been declared with an explicit type. In Fortran, all variables must have an explicit type, such as integer or real, declared before they can be used in a program. This is known as implicit typing.

To fix this error, you will need to declare the type of each variable before using it in your program. For example, you could declare x1 as a real variable by adding the line "real (kind=4) :: x1" before the subroutine declaration. This will ensure that the compiler knows what type of variable x1 is and can properly use it in the program.

It is important to explicitly declare the type of all variables in your program to avoid errors and ensure that your code runs correctly. Additionally, it is good practice to initialize all variables with a value before using them in your program. This will help prevent any unexpected behavior and improve the overall quality of your code.
 

1. What is the meaning of the error message "symbol 'x1' has no implicit type"?

This error message means that the variable 'x1' has not been assigned a data type, causing the code to not be able to interpret what type of data it is supposed to hold.

2. What could be the potential cause of this error message?

The most common cause of this error is that the variable 'x1' has not been declared or initialized with a data type before it is used in the code.

3. How can I fix this error message?

To fix this error, you can declare the variable 'x1' with a data type before using it in the code. For example, you can declare it as an integer by using the keyword 'int' followed by the variable name.

4. Can this error message be caused by any other factors?

Yes, this error can also be caused by a misspelling of the variable name, or if the variable is being used in a different scope than where it was declared.

5. Is there a way to prevent this error from occurring?

Yes, you can prevent this error by always declaring variables with a data type before using them in the code. This will ensure that the code knows what type of data the variable is supposed to hold.

Similar threads

  • Programming and Computer Science
Replies
9
Views
9K
  • Programming and Computer Science
Replies
2
Views
2K
  • Introductory Physics Homework Help
Replies
1
Views
862
  • Programming and Computer Science
Replies
6
Views
2K
  • Topology and Analysis
Replies
16
Views
2K
  • Special and General Relativity
3
Replies
75
Views
3K
  • Engineering and Comp Sci Homework Help
Replies
5
Views
1K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
3
Views
2K
  • Engineering and Comp Sci Homework Help
Replies
25
Views
4K
  • Engineering and Comp Sci Homework Help
Replies
1
Views
2K
Back
Top