Fortran What causes undefined reference errors in gfortran compilation?

  • Thread starter Thread starter SAks
  • Start date Start date
  • Tags Tags
    Gfortran
AI Thread Summary
The user is encountering compilation issues with Fortran while trying to link the BLAS library. The initial error indicates that the linker cannot find the BLAS library, suggesting it may not be installed or is located in a non-standard directory. To resolve this, the user is advised to specify the library's directory using the -L option followed by the full path. After attempting this, a new error arises related to an undefined reference to `MAIN__`, indicating a potential issue with the main program structure in the Fortran code or missing required components. Further troubleshooting is needed to address the undefined reference error.
SAks
Messages
6
Reaction score
0
Hi friends!
I am a complete newbie to fortran..
I've been trying to compile linpack but keep getting following error..

[SAks@localhost Desktop]$ gfortran schdc.f -lblas
/usr/bin/ld: cannot find -lblas
collect2: ld returned 1 exit status


please advise..

Thanks in advance
 
Technology news on Phys.org
It means that the 'blas' library either is not installed, or is not in the location where the compiler (actually the linker) expects to find it.

If that library is in a non-standard location, e.g. /foo/bar/blas.a or /foo/bar/blas.dylib or whatever filename extension your OS uses for libraries, then you can tell the linker to search the directory /foo/bar for libraries, in addition to wherever it already searches:

gfortran schdc.f -L/foo/bar -lblas

You might have to add a slash: -L/foo/bar/ (it's been a long time since I had to do this)

The main thing is to give the full directory path.
 
@jtbell
thanks for responding..
I did give the whole path, now some new problem..
this is what i get..

[SAks@localhost Desktop]$ gfortran schdc.f -L/home/SAks/Desktop -lblas
/usr/lib/gcc/x86_64-redhat-linux/4.4.5/libgfortranbegin.a(fmain.o): In function `main':
(.text+0x26): undefined reference to `MAIN__'
collect2: ld returned 1 exit status
 
Thread 'Star maps using Blender'
Blender just recently dropped a new version, 4.5(with 5.0 on the horizon), and within it was a new feature for which I immediately thought of a use for. The new feature was a .csv importer for Geometry nodes. Geometry nodes are a method of modelling that uses a node tree to create 3D models which offers more flexibility than straight modeling does. The .csv importer node allows you to bring in a .csv file and use the data in it to control aspects of your model. So for example, if you...
I tried a web search "the loss of programming ", and found an article saying that all aspects of writing, developing, and testing software programs will one day all be handled through artificial intelligence. One must wonder then, who is responsible. WHO is responsible for any problems, bugs, deficiencies, or whatever malfunctions which the programs make their users endure? Things may work wrong however the "wrong" happens. AI needs to fix the problems for the users. Any way to...

Similar threads

Replies
6
Views
2K
Replies
9
Views
9K
Replies
5
Views
10K
Replies
16
Views
6K
Replies
4
Views
7K
Replies
3
Views
12K
Replies
6
Views
2K
Back
Top