- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I am having the follwoing example code:
#include "mkl.h"
#include
#define N 5
void main()
{
MKL_INT n = N, inca = 1, incb = 1, i;
MKL_Complex16 a, b, c;
for( i = 0; i < n; i++ ){
a.real = (double)i; a.imag = (double)i * 2.0;
b.real = (double)(n - i); b.imag = (double)i * 2.0;
}
zdotc( &c, &n, a, &inca, b, &incb );
printf( "The complex dot product is: ( %6.2f, %6.2f)\\n", a[1].real, a[1].imag );
system("PAUSE");
}
And I got following error message:
error LNK2019: unresolved external symbol _zdotc referenced in function _main
I think I did Additional dependencies for linkecorrect The following is what I have for this project:
mkl_intel_ilp64.lib
mkl_intel_thread.lib
mkl_core.lib
mkl_solver_ilp64.lib
What else do I
#include "mkl.h"
#include
#define N 5
void main()
{
MKL_INT n = N, inca = 1, incb = 1, i;
MKL_Complex16 a
for( i = 0; i < n; i++ ){
a.real = (double)i; a.imag = (double)i * 2.0;
b.real = (double)(n - i); b.imag = (double)i * 2.0;
}
zdotc( &c, &n, a, &inca, b, &incb );
printf( "The complex dot product is: ( %6.2f, %6.2f)\\n", a[1].real, a[1].imag );
system("PAUSE");
}
And I got following error message:
error LNK2019: unresolved external symbol _zdotc referenced in function _main
I think I did Additional dependencies for linkecorrect The following is what I have for this project:
mkl_intel_ilp64.lib
mkl_intel_thread.lib
mkl_core.lib
mkl_solver_ilp64.lib
What else do I
Link Copied
4 Replies
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
You are calling a Fortran-77 routine (zdotc) from a mix of C and C++ (#include ). Note that there are C interfaces to the MKL routines, as well.
The dot product is going to be in the variable c, not a[1]. Here is a modified version of zdotex.c:
The dot product is going to be in the variable c, not a[1]. Here is a modified version of zdotex.c:
[cpp]#includeCompiling this, linking with the libraries that you listed, and running the .EXE file produced gave me the output#include #define N 5 int main() { MKL_INT n = N, inca = 1, incb = 1, i; MKL_Complex16 a , b , c; for( i = 0; i < n; i++ ){ a.real = (double)i; a.imag = (double)i * 2.0; b.real = (double)(n - i); b.imag = (double)i * 2.0; } zdotc( &c, &n, a, &inca, b, &incb ); printf( "The complex dot product is: ( %6.2f, %6.2f)n", c.real, c.imag ); } [/cpp]
[cpp]The complex dot product is: (140.00, 20.00)[/cpp]
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
one comment on this topic. We can see that Yuzhuo used ilp64 interfaces. For this case, if you linked with ILP64 MKL libraries you need to add compiler option -DMKL_ILP64 for C-compilation.
We recomend to see more info into mkl's user's guide or into this forum, say here.
--Gennady
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
one more comments :).MSVC 2010 on 64bit Windows support both 32bit and 64bit application development.Ifyou'd like to link MKL ILP64 library,then your MSVC 2010 project configuration is supposed to be "x64", not the default "Win32".
In MSVS 2010* environment,please checkthe optionBuild=>Configuration Manager=> active platform.Select"X64" (if 64bit application).
Here is one genral KBabout MKL usage in VS1020 in Compiling and Linking MKL with Microsoft* Visual C/C++* .
and the on-line KB article Intel Math Kernel Library Link Line Advisorfor your reference,
Regards,
Ying
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Sorry for not being replied to this thread any earlier. But THANK you all for your help. And Ying H's suggestion solves my problem.
Reply
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page