PLEASE HELP A gfortran NEWBIE...

Joined
May 28, 2012
Messages
3
Reaction score
0
Points
1
I'm running a late 2011 13" MacBook Pro with a 2.7 GHz Intel Core i7 processor and OS-X 10.7.4

Today I downloaded XCode via the Mac App Store and successfully installed it with a default install and no error messages.

I also downloaded and successfully executed the gfortran apple installer (version 4.6.2) for OX Lion (10.7) - installer released 2011-10-20 from the GCC website.

I then went into my user directory via the Terminal, and found there was no ".bash_profile" file. So I created one with a single line (followed by a carriage return). The single line is:
"export PATH=/usr/local/bin:$PATH"

I restarted my computer at this point.

I then created a simple fortran text file (named hiworld.f77 and saved as text), that reads:
PROGRAM HIWORLD
WRITE(UNIT=*, FMT=*) 'Hello World'
END

When I try to compile the code (from within the directory the hiworld.f77 source code is in) with the following statement from the Terminal,

gfortran hiworld.f77 -o hiworld

I receive the following error message from the Terminal:

"collect2: cannot find 'ld'

I get the same error message if I attempt to compile with the following command:

/usr/local/bin/gfortran hiworld.f77 -o hiworld

WHAT AM I DOING WRONG?
 

cwa107


Retired Staff
Joined
Dec 20, 2006
Messages
27,042
Reaction score
812
Points
113
Location
Lake Mary, Florida
Your Mac's Specs
14" MacBook Pro M1 Pro, 16GB RAM, 1TB SSD
I've moved your post to a more proper forum; please be sure to check the forum descriptions to find the best place to post.

By posting in the right forum you help people not only find your question faster, but it helps others looking for the same information in the future.

Thanks for understanding!
 
OP
C
Joined
May 28, 2012
Messages
3
Reaction score
0
Points
1
Thanks

And thank you for the assistance. My first post on the forum, so I do appreciate it.
 
OP
C
Joined
May 28, 2012
Messages
3
Reaction score
0
Points
1
Further Developments

Based on some related posts here, I went back and installed the XCode Command Line tools via the Downloads tab on the XCode Preferences Window.

Now, when I type in gfortran hiworld.f77 -o hiworld,

I get the following...

ld: warning: ignoring file hiworld.f77, file was built for unsupported file format which is not the architecture being linked (x86_64)
Undefined symbols for architecture x86_64:
"_main", referenced from:
start in crt1.10.5.o
ld: symbol(s) not found for architecture x86_64
collect2: ld returned 1 exit status
 

Shop Amazon


Shop for your Apple, Mac, iPhone and other computer products on Amazon.
We are a participant in the Amazon Services LLC Associates Program, an affiliate program designed to provide a means for us to earn fees by linking to Amazon and affiliated sites.
Top