Compatibility between Fortran compiler 12.1, Xcode 4.5 and Mountain Lion?

Compatibility between Fortran compiler 12.1, Xcode 4.5 and Mountain Lion?


I am new to fortran and I recently installed the Intel Fortran compiler (version 12.1) on my Mac, which has Xcode 4.5 and OSX 10.8. As a starting point, I tried to compile the very simple program hello.F90:

- - - - -

program hello
print *, "So, this seems to be working now...."
end program hello

- - - - -

by typing in an xterm window the command: $ ifort hello hello.F90

 However, I get the following error: ld: can't link with a main executable for architecture x86_64

Is this a compatibility issue between my OS, Xcode and fortran version, or is it a much simpler bug that I am missing?

Many thanks in advance for your help.

5 posts / 0 new
Last post
For more complete information about compiler optimizations, see our Optimization Notice.

that's an odd one.  What specific 12.1 version?

ifort -V

will let us know.

Next, did you do this first:

source /opt/intel/bin/ intel64


ifort -o hello hello.f90    !you didn't show the -o argument but I'm assuming it's just a typo


Hi Ron, 

Thanks for your quick response.  My version is 12.1.4.  I had not entered the "source" command, thanks for that....the program now runs. The missing "-o" was a typo.

Ultimately, I would like to be able to use ifort to compile fortran subrutines in matlab using their mex files. Could you or someone in this forum point me to a webpage that has information on how to set up ifort on the file? 

Again, thanks for your help!

Probably the best source would be Mathworks "Answers" forum:


Thanks, Ron. I will see if I can get help at the Mathworks forum.

Leave a Comment

Please sign in to add a comment. Not a member? Join today