问题
I am trying to learn Fortran programming language, as a test I wrote a simple program like this:
!Fortran Program
program first
print *, "Hello World"
end program first
Then I threw this code file in to mac terminal and run gfortran first.f95
which then gave me an output of a.out
as expected.
However, when I try to run the output in terminal by navigating into the output directory and typing ./a.out
. It gave me this error output:
dyld: Library not loaded: @rpath/libgfortran.3.dylib
Referenced from: /Users/liang/Desktop/Programs/Fortran/Test/a.out
Reason: image not found
liang
is my username.
回答1:
I had the same problem, and my problem was caused because the library was not in default path and instead "anaconda" got in the path so that's why the compiler could not load it. I am a pure amateur user so I may explain not accurate in terms of technical words.
What I did was, I uninstalled my anaconda and deleted the folder in my Mac. Installed gcc "brew install gcc" again, and it worked! and then after, I installed my anaconda again, so now everything seemingly is ok.
来源:https://stackoverflow.com/questions/49344474/dyld-library-not-loaded-rpath-libgfortran-3-dylib