by dbindel » Tue Jan 25, 2005 8:13 pm
I'm not too familiar with Dev-C++, but I know it is built on top of the MinGW port of the GNU compiler, with which LAPACK should work fine. If you have a shell environment (e.g. MSYS), you should be able to build LAPACK using the standard makefiles. You may need to edit the time routine (sorry, I will have to go back to check this).
Perhaps you can give a few more details about the error message you received? You're using a particularly tricky combination of compilers, and there are several possible common errors that you might be experiencing:
1. Missing underscore
The GNU Fortran naming convention appends an underscore for binding to C. For example, dgetrf in Fortran becomes dgetrf_ in C. This is *not* the same as what some of the other Windows Fortran compilers do (I think you'd have to use the name DGETRF if you compiled with Compaq Fortran, for example).
2. Missing extern "C"
When you declare Fortran functions for use in the C++ code, you need to wrap them in an extern "C" directive to tell the C++ compiler that it should not use name mangling. For instance, to declare the factorization routine dgetrf, you would write
extern "C" {
int dgetrf_(int *m, int *n, double* a, int* lda, int *ipiv, int *info);
}
or for a more natural C++ interface
extern "C" {
int dgetrf_(const int& m, const int& n, double* a, const int& lda, int *ipiv, int& info);
}
3. Missing BLAS or Fortran support libraries
You will need not only to include LAPACK in your link line, but also a BLAS library and the Fortran support library. Furthermore, if you use -l to indicate your libraries, you need to include the libraries in exactly that order (LAPACK, then BLAS, then the support library). For example, to compile a file foo.cc, I would write
g++ -o foo.x foo.cc -llapack -lblas -lg2c
If you want a fast BLAS, I recommend the Goto BLAS (you can find it with a web search).
From your description, it's hard to tell whether the problem you're having is really with linking the LAPACK library or with one of these peripheral issues.
Hope this helps,
David