Latest LQ Deal: Latest LQ Deals
Go Back > Forums > Linux Forums > Linux - Newbie
User Name
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!


  Search this Thread
Old 09-26-2013, 07:11 AM   #1
LQ Newbie
Registered: Sep 2010
Posts: 18

Rep: Reputation: 0
gfortran linking/compiling with -I and -J flags

I am trying to link and compile a couple of modules that are not in the current directory with a couple of my own .f90 programs and out put the .exe to a folder that is not the current directory. It appears to me that I have to use flags -I and -J when compiling with gfortran but not sure the correct use of these. If anyone can help that would be great. Many thanks!

Here's what I've tried thus far (an example) based on an online tutorial but I am getting the error "Fatal Error: Can't open module file 'spectra.mod' for reading at (1): No such file or directory" in the first line itself. mod1.mod has the correct path declared.


gfortran -c ${P_PATH}/my_prog1.f90 -I${M_PATH}/mod1.mod -o ${O_PATH}/my_prog.o

gfortran -o ${O_PATH}/myprog.exe ${O_PATH}/my_prog.o

Last edited by januka; 09-26-2013 at 08:33 AM.
Old 09-26-2013, 10:56 AM   #2
LQ Newbie
Registered: Sep 2010
Posts: 18

Original Poster
Rep: Reputation: 0

gfortran -O -I${P_PATH}/example_prog.f90 -L/${M_PATH}/ -lexample.mod -o example.exe

"-I" in -I${DSKT}/example_prog.f90 is uppercase "ai" and
"-l" in -lexample.mod is lower case "el"


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
How much faster can the compiling be if I use the USE flags well? Ben_the1st Gentoo 9 01-07-2010 10:53 AM
gfortran compiling problem, RHEL 4 The_Watcher Linux - Enterprise 1 08-22-2008 11:57 AM
undefined gfortran references when compiling with g77 StudMuffin Linux - Software 4 02-17-2007 06:06 AM
flags for compiling Xlib.h in gcc Maidros Programming 2 06-15-2005 05:00 AM
optimization flags and kernel compiling kpachopoulos Linux - Newbie 2 08-26-2004 07:29 AM > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 04:59 AM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration