I think everything should work fine, but I end up getting an error message:
undefined reference to `dgemm_'
Post a build log and maybe some could help you!Build log would just say that undefined reference error and I added a short program example too. It is all there, thanks
In case it is a simple mistake; without a build log you are wasting band width and everyone's time
Edit: BLAS and LAPACK are libraries that building them yourself is likely possible.
But, MATGEN is not a library that Google has very much about.
Edit2: Most of the Google results is about the matgen command/program. I have not found a matgen library!
Tim S.
Thank you for the answer.I think everything should work fine, but I end up getting an error message:
undefined reference to `dgemm_'
That looks like a linker error.
I don't know the compiler(s) you are using or whether your project is all Fortran or mixed C++/Fortran, or whether the libraries were compiled by you. A *.lib library is the typical result of Visual Studio-compatible compiler (I guess it is Intel Fortran nowadays, in ancient times it was Fortran Powerstation and before history began it was VAX Fortran). GCC or variants typically create *.a static libraries if I am not mistaken.
So the question is whether your wingw64 compiler produces compatible object code with those intel libraries, probably compiled with an Intel compiler. From the '_' suffix I am guessing it does not, it is what your wingw64 compiler expects it to be, but the intel compiler probably 'decorates' the subroutine names in a different way, causing the linker error.
Your best bet is to recompile those libraries using the compiler you are using, or alternatively use an intel compiler for your own code.
I used to deal with such issues a long time ago when calling Fortran from C++ http://arnholm.org/software/cppf77/cppf77.htm
$ pacman -Qs lapack
local/mingw-w64-x86_64-lapack 3.8.0-5
Linear Algebra PACKage (mingw-w64)
-------------- Build: Debug in dgemm (compiler: GNU Fortran Compiler)---------------
gfortran.exe -Jobj\Debug\ -Wall -g -c C:\Users\stahta01\devel\test\dgemm\main.f95 -o obj\Debug\main.o
gfortran.exe -o bin\Debug\dgemm.exe obj\Debug\main.o -llapack -lblas
Output file is bin\Debug\dgemm.exe with size 319.11 KB
Process terminated with status 0 (0 minute(s), 0 second(s))
0 error(s), 0 warning(s) (0 minute(s), 0 second(s))
Do you have the source code so I can recompile?
Sample FORTRAN file builds OK for me; with minor code edit.
Sample FORTRAN file builds OK for me; with minor code edit.
What did you do?
You just installed the file from http://netlib.org/lapack/lapack.tgz by using MSys2 MinGW64, is that it? (I'm not experienced in dealing with those things, I'm not sure if I understood what you did. I guess you didn't create a .a library and simply linked it. And also you are not working with the .lib I provided, right?)
Would you be able to compile it with Codeblocks IDE?
-------------- Build: Debug in blas_test (compiler: GNU Fortran Compiler)---------------
x86_64-w64-mingw32-gfortran.exe -Jobj\Debug\ -ffree-form -Wall -g -c C:\SourceCode\test\blas_test\main.f90 -o obj\Debug\main.o
x86_64-w64-mingw32-gfortran.exe -L..\blas_test -o bin\Debug\blas_test.exe obj\Debug\main.o -lopenblas
Output file is bin\Debug\blas_test.exe with size 16.58 MB
Process terminated with status 0 (0 minute(s), 3 second(s))
0 error(s), 0 warning(s) (0 minute(s), 3 second(s))