Community
cancel
Showing results for 
Search instead for 
Did you mean: 
bob_edwards
Beginner
63 Views

Problem compiling CBLAS example 1 for C++ compiler on Windows

Hello,

I am just getting started with the Intel C++ compiler and the Intel Math Kernel Library. As a first step I am trying to compile the examples from:

http://software.intel.com/en-us/articles/intel-math-kernel-library-intel-mkl-blas-cblas-and-lapack-c...

To setup the environment I run the "C++ Build Environment for applications running on Intel 64" bat file to start the command window. Then I run the "F:\\Intel\\MKL\\10.2.5.035\\tools\\environment\\mklvars64.bat" file to set the MKL environment variables.

Then I attempt to compile with icl:

icl main.cpp

The error that I get is:

main.cpp(5): error: more than one instance of overloaded function "cblas_zdotc_sub" has "C" linkage

extern "C" void cblas_zdotc_sub(complex16*, int *, complex16 *, int *, complex16 *, int *);

I have tried various permutations of linking -lmkl libraries and different command line options. Can anyone provide some advice? Thanks.

Bob

The exact source code is:


#include

#include "mkl.h"
typedef struct{ double re; double im; } complex16;
extern "C" void cblas_zdotc_sub(complex16*, int *, complex16 *, int *, complex16 *, int *);

#define N 5

int main()
{
int n, inca = 1, incb = 1, i;

complex16 a, b, c;

n = N;
for( i = 0; i < n; i++ ){
a.re = (double)i; a.im = (double)i * 2.0;
b.re = (double)(n - i); b.im = (double)i * 2.0;
}
cblas_zdotc_sub(&c, &n, a, &inca, b, &incb );
printf( "The complex dot product is: ( %6.2f, %6.2f) ", c.re, c.im );

return 0;
}


0 Kudos
1 Reply
Gennady_F_Intel
Moderator
63 Views

Bob,
let's try to modify the code:

complex16 res;
//cblas_zdotc_sub(&c, &n, a, &inca, b, &incb );
cblas_zdotc_sub( n, a, inca, b, incb, &res );
--Gennady
Reply