Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [photran] How to build a Fortran project ???

The default for make is to build the files in alphabetical (lexical) order, but if you have modules that seldom works because the module must be compiled before any file that uses it.  So you need a Makefile with dependencies, but those will not be scanned automatically.  You have to create a Makefile yourself and then set your project up not as a default Fortran project, but as a manual makefile project, and import your Makefile to the project.  (Keep in mind that Eclipse really, really wants to manage the files itself.  Usually just copying the file into the directory won't work.)

You should be able to use the default Xcode command-line make if you've got those tools installed.

If you aren't familiar with make (it has a cranky syntax) there's a basic tutorial at

https://en.wikibooks.org/wiki/Make

It's for C/C++ but the basics are the same.

To help with Fortran you can get a Perl script called makemake that will set up a skeleton Makefile for you (it will need some things filled in, like the name of the program and changing F90=f90 to F90=gfortran).  It's a bit old but should still work.

https://www.fortran.com/makemake.perl

perl should be on the Mac.

That's usually what causes the type of error you're describing.  It's really the .mod file it can't find (since it hasn't been created yet when Main_program.f90 is being compiled).

On 09/11/2015 01:17 PM, Julien Colin wrote:
Hi,

Sorry, I am not a expert. I don't find my answer on this forum and Internet or maybe I don't understand these answers.

I developed a Fortran program on Windows through an old IDE: Compact Visual Fortran.

I am now a Mac user and I want to develop and run my program thanks to Eclipse. But I haven't succeed yet.

I used this tutorial for installation:
https://wiki.eclipse.org/PTP/photran/documentation/photran9installation
- I updated my Java Virtual Machine (1.8)
- I installed Gfortran
- I didn't understand how to install or use the make program (GNU make). I don't know which file to download (make-4.1.tar.bz2 or .bz2.sig or .gz or .gz.sig) and I don't know what to do after downloading. However, Xcode Command Line Tools are installed on my Mac.
- I installed Eclipse for Parallel Application Developpers 4.5.0.

My program is split into three files:

*Modules.f90* which contains:
Module Modul
Implicit None
...
End Module Modul

*Subroutines.f90* which contains:
Subroutine Sub1()
Use Modul
Implicit none
...
End Subroutine Sub1
Subroutine Sub2()
Use Modul
Implicit none
...
End Subroutine Sub2
...
Subroutine SubN()
Use Modul
Implicit none
...
End Subroutine SubN

*Main_program.f90* which contains:
Program Main
Use Modul
Implicit none
...
End

When I click on the button "Build 'Debug' for project 'name_of_my_project'", a problem occurs:
'Build Project' has encountered a problem. An internal error occurred during: "Build Project".
Could not find a file to match the module name: Modul

For sure, my program works: I can build the project and run my program when I copy all the content of Modules.f90 and Subroutines.f90 into Main_program.f90.
To my mind, Eclipse doesn't link together the source files of the program and I don't now how to do it.

I have looked for a solution for two weeks...
Could anyone help me by explaining how to do step by step?

Sorry: maybe my question is stupid.

Thanks a lot for your answers.

Julien.

---
Julien COLIN



_______________________________________________
photran mailing list
photran@xxxxxxxxxxx
To change your delivery options, retrieve your password, or unsubscribe from this list, visit
https://dev.eclipse.org/mailman/listinfo/photran


-- 
Katherine Holcomb
UVACSE                       kholcomb@xxxxxxxxxxxx
112 Albert Small Building    (434) 982-5948
University of Virginia       Charlottesville, VA 22904

Back to the top