Gfortran not working on Mac OS X 10.9 (Mavericks)

I recently upgraded my X OS to 10.9 (Mavericks); Unfortunately, gfortran stops working, although I updated the Xcode command line to 5.1.1 for OS X Mavericks. A similar question was asked once, here , but I don’t think the problem was sorted out.

here is what i did:

I first deleted the existing gfortran

bash-3.2$ sudo rm -r /usr/local/gfortran /usr/local/bin/gfortran

Then I downloaded gfortran-4.9-bin.tar and unzipped it and successfully installed

bash-3.2$ gunzip gfortran-4.9-bin.tar

bash-3.2$ sudo tar xvf gfortran-4.9-bin.tar -C /

bash-3.2$ which gfortran     
/usr/local/bin/gfortran

but when I run my codes, I got the following errors, for example.

bash-3.2$ gfortran boolean1.f90

Undefined symbols for architecture x86_64:
      "_main", referenced from:
         implicit entry/start for main executable
    ld: symbol(s) not found for architecture x86_64
    collect2: error: ld returned 1 exit status

I would be very grateful if anyone could help me solve this problem.

+4
source share
1 answer

. gfortran , :

https://gcc.gnu.org/wiki/GFortran

macOS : http://coudert.name/software/gfortran-6.3-Sierra.dmg

( dmg),

! fort_sample.f90
program main
  write (*,*) 'Hello'
  stop
end

> gfortran -o fort_sample fort_sample.f90
> ./fort_sample
 Hello
0

Source: https://habr.com/ru/post/1539474/


All Articles