I write a function using arrayfire like that:
int ABC()
{
static const int Q = 5;
double A[] = { 0.0, 1.0, 0.0, 1.0, 1.0};
double B[] = { 0.0, -1.0, -1.0, 1.0, 0.0 };
array C (Q, 1, A);
array D (Q, 1, B);
return 0;
}
When I try to call this function as: ABC()
in the main program and try to extract the variables C
and D
and want to print them using af_print(C)
, gives the error:
error C2065: 'C' : undeclared identifier
error C2065: 'D' : undeclared identifier
IntelliSense: identifier "C" is undefined
IntelliSense: identifier "D" is undefined
The main function is:
#include <cstdio>
#include <math.h>
#include <cstdlib>
#include "test.h"
// test.h contains the function ABC() and
// arrayfire.h and
// using namespace af;
int main(int argc, char *argv[])
{
ABC(); // function
// here I am calling the variables defined in ABC()
af_print(C);
af_print(D);
#ifdef WIN32 // pause in Windows
if (!(argc == 2 && argv[1][0] == '-')) {
printf("hit [enter]...");
fflush(stdout);
getchar();
}
#endif
return 0;
}
Any solution please.
Regards