Community
cancel
Showing results for 
Search instead for 
Did you mean: 
Shi__Yue
Beginner
73 Views

[Help] Example works with extention .c but fails with .cpp

Jump to solution

Hi,

I have a big (n~100,000) complex matrix which I would like to diagonlize.

After googling extensively, I found the following link provides excellent example.

https://software.intel.com/sites/products/documentation/doclib/mkl_sa/11/mkl_lapack_examples/lapacke...

I was planning to be able have it work with my smaller problem before turning to a routine with parallel capabilities etc.

It compiles with "icc zheev.c -mkl -o test" on my machine and produced the correct output.

But when I tried to merge it into my code with a .cpp extension, it complains about

undefined reference to `zheev(char*, char*, int*, _dcomplex*, int*, double*, _dcomplex*, int*, double*, int*)'

After checking around, I found that this is presumably due to the extension that I have .cpp.

If I rename the zheev.c to zheev.cpp, "icc zheev.cpp -mkl -o test" complains also undefined reference to `zheev(char...

I know the problem may be too simple, please bear with me, this is my first day of using the routine.

Thanks,

Yue

0 Kudos
1 Solution
mecej4
Black Belt
73 Views

To prevent C++ name decoration from being applied, surround the prototype declarations for MKL routines with exterm "C" {}; see http://www.cplusplus.com/forum/general/1143/ .

View solution in original post

2 Replies
mecej4
Black Belt
74 Views

To prevent C++ name decoration from being applied, surround the prototype declarations for MKL routines with exterm "C" {}; see http://www.cplusplus.com/forum/general/1143/ .

View solution in original post

Shi__Yue
Beginner
73 Views

Hi mecej4,

Thanks for the quick reply. It solved my problem.

Best regards,

Yue

Reply