Community
cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
Beginner
11 Views

MKL g++ issue on Mac 10.11

Hey, I am trying to run a simple lapack example (lets say the dsyev example, https://software.intel.com/sites/products/documentation/doclib/mkl_sa/11/mkl_lapack_examples/dsyev_e...with MKL 2017 installed on my Mac 10.11.6, using gcc 4.9.2.

Using the online linker, my link line looks like this

gcc -o dsyev dsyev.c  -L${MKLROOT}/lib -Wl,-rpath,${MKLROOT}/lib -lmkl_intel_lp64 -lmkl_intel_thread -lmkl_core -liomp5 -lpthread -lm -ldl -DMKL_LP64 -m64 -I${MKLROOT}/include

which works fine and yields the correct output.

However, I am now trying to use g++ (since my actual project is written in C++), change the "malloc"s into "new"s etc., but upon compiling (using the exact same link line as above), I get a "symbols not found" error for dsyev.

Is there something I am missing? Thanks a lot in advance.

0 Kudos
2 Replies
Highlighted
Black Belt
11 Views

Please show us the prototype declarations for the MKL routine(s) and the actual linker message. C++ name mangling may be the culprit, especially if you did not use extern "C" {} around the prototype declarations.

0 Kudos
Highlighted
Beginner
11 Views

… Of course, thats it, forgot the extern "C" {…}. Thank you so much!

For future readers, the following prototype declaration resolves my issue.

extern "C" { void dsyev( char* jobz, char* uplo, int* n, double* a, int* lda,
                        double* w, double* work, int* lwork, int* info );}

 

0 Kudos