Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.
28873 Discussions

Could not find a file to match the module name - Eclipse IDE

Luca_Doro
Beginner
2,615 Views

Hi,

I am very little experience with the compiling process, but I am trying to learn little by little.

I am working under Ubuntu using Eclipse IDE integrated with Intel parallel studio XE 2016 composer edition for Fortran and I am having a problem in the build process. I managed to compile ad create the executable file of a program with only two source files, but now I would like to compile and create an executable for a program based on several .f90 files. The problem is that when I try to build the program I am having the following error: An internal error occurred during: "Build Project". Could not find a file to match the module name: MY_FILE.

I repeat that I have very little experience and probably I am doing some errors in very basic and simple points of the process. Can anyone help me?

Thanks

Luca

0 Kudos
8 Replies
mecej4
Honored Contributor III
2,615 Views

I do not know whether or not Eclipse knows enough (about Fortran modules and their dependencies) to build source files in the proper order. In order to compile a source file that contains USE module_xyz statements, the source file that contains the definition of MODULE module_xyz has to have been compiled successfully.

0 Kudos
Luca_Doro
Beginner
2,615 Views

Thanks for this hint.

I will look more information about Eclipse and modules and their dependencies. Hopefully it will solve my problem.

0 Kudos
Johannes_Rieke
New Contributor III
2,615 Views

Hi Luca,

I experienced similar some time ago with Eclipse. I remember that the module have to be in its own file with the same name of this module (MyMod -> MyMod.f90) and that only one module per file is allowed. Have you tried this?

Maybe in newer Eclipse versions this is not necessary anymore, I would try it.

Regards, Johannes

0 Kudos
Steven_L_Intel1
Employee
2,615 Views

I think there is confusion from the multiple meanings of "module". It would seem to me that it is not the Fortran sense of the word being used here, since the message Luca describes is not a Fortran compiler message. Rather it seems to be something related to the Eclipse environment.

While I have zero experience with Eclipse, you need the Photran FDT to have Eclipse understand Fortran. In the past you had to get this separately but I now see it is included with more recent Eclipse builds.

My advice is to browse the Photran web pages and look for a community resource that discusses it. (Of course, if there are Photran users here, by all means please jump in!)

0 Kudos
Johannes_Rieke
New Contributor III
2,615 Views

Hi all,

I made a quick check with Eclipse Mars (current version, Photran is included if you take the 'for parallel application developers' version as Steve mentioned). I made a sample project containing a Fortran module file and a second file containing the main program. I had no success in getting it compiled after different tries (spent only 5 minutes, changed module name/file name). The make instructions has been missing the compilation of the module file...

After that I switched to Code::Blocks. 30 seconds later the code was compiled and I got results in a console window. It's for sure not a fault of Eclipse, but I personally think Eclipse is not intuitive and has many switches... I.e. you have to read more backround information and learn how to work with Eclipse.

Code::Blocks 16.01 supports also Fortran and I got fast results without reading how it works. So, more time for coding...

If you have the free choice for an IDE, I would try Code::Blocks.

Regards, Johannes

0 Kudos
Luca_Doro
Beginner
2,615 Views

Johannes wrote:

Hi Luca,

I experienced similar some time ago with Eclipse. I remember that the module have to be in its own file with the same name of this module (MyMod -> MyMod.f90) and that only one module per file is allowed. Have you tried this?

Maybe in newer Eclipse versions this is not necessary anymore, I would try it.

Regards, Johannes

Hi Johannes,

 

Thanks for your comment. I think I have already tried the solution that you are suggesting, but I will try it again. I think that for this solution I have to do some other modification. I will try to explain with an example...

Let's say my entire project is based on a main file (main.f90), two subroutines (sub1.f90 and sub2.f90) and a file with the module (mod.f90) with the module called MyMod. The main file has the two following statements: INCLUDE 'mod.f90' and USE MyMod; while the files sub1 and sub2 have the statement USE MyMod. I think that what I have to do (and what I did) is to rename the file with the module from mod.f90 to MyMod.f90 and in the main file replace INCLUDE 'mod.f90' with INCLUDE 'MyMod.f90'.

Am I correct?

Thanks, Luca

0 Kudos
Luca_Doro
Beginner
2,615 Views

Thanks you all for the feedback and comments. You are great!

I agree with Steve that the problem is not related to the Fortran compiler and seems to be related to the Eclipse environment.

I am working with the Eclipse for parallel application development so Photran should be already included. Since I don't have a specific need/preference for an IDE I will try Code::Blocks. I started with Eclipse because I was already using it with some easy Perl and Python program. Moreover, it seems that Eclipse is the only IDE that support the Intel Fortran Compiler for Linux...

I will try the different solutions and keep you updated on this. Thank you so much for your help.

Luca

0 Kudos
m-mauersberger
Beginner
2,446 Views

Hi there,

although it has been a while since the last post was written... I have a possible solution for this kind of problem.

I made up a Fortran project with GNU make as build command. In order to avoid the same error as described, I had to change the build directory to my user-specific path. Automatic Makefile generation had to manually turned off and the appropriate project folder had to be added at "Refresh Policy" as well.

Hope that helps subsequent readers of this topic.

 

Best regards

Michael

0 Kudos
Reply