- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
I had compilation errors on a code that define several kind values
type data_types
integer(kind=int32) :: IntParam1
integer(kind=int16) :: IntParam2
integer(kind=int32) :: IntParam3
real(kind=real32) :: RealParam4
real(kind=real64) :: RealParam5
end type data_types
This is saved as data_types.f90
Then I have the main code (main.f90) that uses the types defined above.
While compiling:
ifort main.f90 data_types.f90 -o output
I had a long list of errors related to the variables defined in the data_types.f90 part.
This name does not have a type, and must an explicit type [IntParam1]
This name does not have a type, and must an explicit type [IntParam2]
This name does not have a type, and must an explicit type [IntParam3]
This name does not have a type, and must an explicit type [RealParam4]
This name does not have a type, and must an explicit type [RealParam5]
I am confused and need help about this. Is there something going wrong with my variable definitions or kind values or can this be supported by adding some options in the line command for compling.
Advance thanks.
I had compilation errors on a code that define several kind values
type data_types
integer(kind=int32) :: IntParam1
integer(kind=int16) :: IntParam2
integer(kind=int32) :: IntParam3
real(kind=real32) :: RealParam4
real(kind=real64) :: RealParam5
end type data_types
This is saved as data_types.f90
Then I have the main code (main.f90) that uses the types defined above.
While compiling:
ifort main.f90 data_types.f90 -o output
I had a long list of errors related to the variables defined in the data_types.f90 part.
This name does not have a type, and must an explicit type [IntParam1]
This name does not have a type, and must an explicit type [IntParam2]
This name does not have a type, and must an explicit type [IntParam3]
This name does not have a type, and must an explicit type [RealParam4]
This name does not have a type, and must an explicit type [RealParam5]
I am confused and need help about this. Is there something going wrong with my variable definitions or kind values or can this be supported by adding some options in the line command for compling.
Advance thanks.
Link Copied
2 Replies
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
You will need to show us more of the code - a complete, small(if possible) example will be helpful.
I am not sure what you intended with the source you have in data_types.f90. You say it "define several kind values" but the code you show declares a single derived type called data_types with five components. If you then tried to use one of the component names by itself, such as:
a = IntParam1
then you would get an error if IMPLICIT NONE was in effect because IntParam1 is not itself a variable or a named constant. Please show us more so we can see what you had in mind.
I am not sure what you intended with the source you have in data_types.f90. You say it "define several kind values" but the code you show declares a single derived type called data_types with five components. If you then tried to use one of the component names by itself, such as:
a = IntParam1
then you would get an error if IMPLICIT NONE was in effect because IntParam1 is not itself a variable or a named constant. Please show us more so we can see what you had in mind.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I think you find better luck with
module data_types
...
end module data_types
...
program foo
use data_types
...
Jim Dempsey
module data_types
...
end module data_types
...
program foo
use data_types
...
Jim Dempsey

Reply
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page