From: Ajay on
I am using the VC++ 2008 (Express) downloaded from internet as free s/w.

first error is (Please advice about it):

error C2275: 'mxArray' : illegal use of this type as an expression
c:\program files\matlab\r2009a\extern\include\matrix.h(292) : see declaration of 'mxArray'

Due to this error, C compiler is not recognizing either of pmX, pmY, PmZ.

I added the pragmas to my code to avoid any library to be missing in compiler settings and I changed my code as:

#ifdef _MSC_VER // if MS Visual C++
#pragma warning(push)
#pragma warning(disable:4996)
#pragma comment(lib, "libdfblas.lib")
#pragma comment(lib, "libdflapack.lib")
#pragma comment(lib, "libemlrt.lib")
#pragma comment(lib, "libeng.lib")
#pragma comment(lib, "libfixedpoint.lib")
#pragma comment(lib, "libmat.lib")
#pragma comment(lib, "libmex.lib")
#pragma comment(lib, "libmwblas.lib")
#pragma comment(lib, "libmwlapack.lib")
#pragma comment(lib, "libmwmathutil.lib")
#pragma comment(lib, "libmwservices.lib")
#pragma comment(lib, "libmx.lib")
#pragma comment(lib, "libut.lib")
#pragma comment(lib, "mclcom.lib")
#pragma comment(lib, "mclcommain.lib")
#pragma comment(lib, "mclmcr.lib")
#pragma comment(lib, "mclmcrrt.lib")
#pragma comment(lib, "mclxlmain.lib")
#pragma comment(lib, "first_lib.lib")
#endif

#include <stdio.h>
#include <math.h>
#include "mex.h"
#include "first_lib.h"

int main()
{
double a,b,c, Ans;
a = 1; b =2; c=3;

mxArray *pmX, *pmY, *pmZ;
mxArray *pmAns = NULL;

mclinitializeApplication(NULL,0);

*mxGetPr(pmX) = a;
*mxGetPr(pmY) = b;
*mxGetPr(pmZ) = c;

first_libInitialize();

memcpy(mxGetPr(pmX),&a, sizeof(double)*1);
memcpy(mxGetPr(pmY),&b, sizeof(double)*1);
memcpy(mxGetPr(pmZ),&c, sizeof(double)*1);

mlfFirst(1,&pmAns,pmX,pmY,pmZ);

Ans = *mxGetPr(pmAns);

first_libTerminate();

printf("%f %f\n", Ans);

mxDestroyArray(pmX);
mxDestroyArray(pmY);
mxDestroyArray(pmZ);
mxDestroyArray(pmAns);

mclTerminateApplication();

return 0;
}

Please advice !!!
 | 
Pages: 1
Prev: TD-SCDMA
Next: regarding linearizing equations