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

Undefined reference to _ ERROR in FORTRAN COMPILATION

jdbaba
Beginner
7,876 Views
Hi I am using using LInux system to compile the fortran code. I have around 200 subroutines that I need to compile. Whiel I try to compile the subroutines it gives the error In function "Main" .......... undefined references to 'subroutinename". I have bunch of same error. This is the same code that worked perfectly on visual studio in windows. I am new to linux. Actually, I need to compile this code so that I could be able to run the code on supercomputer. Please help me .......
I have uploaded a snapshot of the error on http://www.filedropper.com/errorinlinux. I am using SecureCRT interface to compile the code in Supercomputer.
Thanks.
JDBABA
0 Kudos
4 Replies
mecej4
Honored Contributor III
7,875 Views
If you want the compiler to compile Fortran source into object code but refrain from linking, you should use the -c compiler flag. Then, when all the necessary source have been compiled, you can issue the command

$ ifort *.o -o myexe

or something similar.
0 Kudos
jdbaba
Beginner
7,875 Views
Hi meceej4,
THanks for the suggestion. I followed your suggestion and first of all I compiled all the codes with -c compiler flag and then I used the command ifort *.o -o program. I didn't use $ before ifort. What does that mean ?
After I compiled the code then I tried to run the compiled code. However, it gives error like :
forttl : No such file or directory
fortt1 : severed (29): file not found, unit 1

Acutally I have the input file on the same folder. I don't know why I am getting such error ? Any help is appeciated.
Jdbaba
0 Kudos
TimP
Honored Contributor III
7,875 Views
The $ quoted by mecej4 presumably refers to the shell prompt.
How do you attach your input file to Fortran unit 1? The most portable way is by OPEN. By default, the file would need read and write permission. You could specify OPEN(action=read....) if you don't intend to allow file modification. In linux, the file name will be case-sensitive, and you will want to assure that it doesn't include invisible characters.
0 Kudos
jdbaba
Beginner
7,875 Views
Tim,
Thank you so much for your reply. It seemed like I didn't care about the case of the input files. I just used the input files that I created in WINDOWS. LINUX needed all the capital case input files and I had lower case input files. THe problem is now solved. Thanks so much.
Jdbaba
0 Kudos
Reply