Contact US

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

module regression and compiling

module regression and compiling

module regression and compiling

Hello there :)

I need to edit and include some old fortran codes in my program. But i'm not familiar with fortran as i thought :D

The code should work but compiling it brings some errors. If I want to compile it with gfortran, the most annoying one is this regression thing:

CODE -->


  use interface

Error: 'sub' of module 'interface', imported at (1), is also the name of the current program unit 

I'm struggling with this for a while now. Are there some compiler options, that can solve this error? Or do i need to make some changes in the code?

Hopefully someone has any idea.

Thanks so far.

RE: module regression and compiling

I can't see your source code, but it may be that the error message is right on...you should try being more specific and meaningful when you name your source files, subroutines, functions and modules...

...for starters, I would stay away from trivial names like "sub"

...secondly, I would stay away from Fortran keywords; in other words, don't name your module 'interface'...again, this is meaningless, add something as to what the interface is for "atom_model_api"

...but, most importantly, "interface" is already a meaningful concept in Fortran, so, maybe you should name your module something like "my_car_model_api" or something specific.

RE: module regression and compiling

oh i'm sorry, in the real code they are named different. i just changed the names to post it here. in origin it looks like that:

CODE -->


  use kur
Error: 'kro' of module 'kur', imported at (1), is also the name of the current program unit 

so, thats not the problem. but thanks for your effort.

I didn't wrote this code by myself, so it should work. It contains many modules with many subroutines and interfaces. I read in old codes it was common to provide all interfaces of all subroutines to all of them, and this may cause the problem. I thought of a compiler option to set or something.

RE: module regression and compiling

are you reading the error message? it says that you may be importing something that has the same name as the current procedure...

RE: module regression and compiling

yes of course. But it's not that easy.

kro uses kur and kur calls many functions that are defined in kro, that makes this error.

But this code once worked, i didn't wrote it on my own. I think this regression became illegal after the code was written. So i search something to make this working and not rewriting all the code.

RE: module regression and compiling

o.k., one last time...just rename something!



RE: module regression and compiling

It seems, that the fortran USE statement makes posiible to rename some module identifiers or to use ONLY some of them we need - see for example this: http://www.eos.ubc.ca/courses/atsc212/labs/fortran...

So in kro I would try to use from kur only that what is needed:


USE kur, ONLY: what, is, needed, here 

or simply rename the identifier kro from kur to somethig else, so it will be not conflicting:



RE: module regression and compiling

exactly that solved my problem :) thank you really much!

I will try to get more into this module thing now, thank you for the tutorial as well.

best regards

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members! Already a Member? Login

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close