C1014 error

G

Guest

i have a fairly simple bit of code which runs fine in the office in Visual
Studio C++.net but when i run it at home I get Fatal Errror C1014...too much
nesting of include statements which is odd since I only have two include
statements.

Why would it work on one Visual C++.net but not on another?

Here is the code:

#include <windows.h>
#include <math.h>
double __stdcall mc(SAFEARRAY **pp_Arg, SAFEARRAY **outa, SAFEARRAY
**RecRate, SAFEARRAY **Pdef)
{
HRESULT hr;
double* lData;
hr= SafeArrayAccessData( *pp_Arg, (void**) &lData );
SafeArrayUnaccessData(*pp_Arg);
double* Recovery;
hr= SafeArrayAccessData( *RecRate, (void**) &Recovery );
SafeArrayUnaccessData(*RecRate);
double* ProbDef;
hr= SafeArrayAccessData( *Pdef, (void**) &ProbDef );
SafeArrayUnaccessData(*Pdef);
const int nCo=165;
static double* p= new double[nCo];
int i,j,k;
double sum;
for (i=0;i<=nCo;i++) {
for (j=i;j<=nCo;j++) {
for (sum=lData[i*166+j],k=i-1;k>=0;k--) sum -=
(lData[i*166+k])*(lData[j*166+k]);
if (i == j) {
p=sqrt(sum);
} else
lData[j*166+i]=sum/p;
}
}
for (i=0;i<nCo;i++)
{
lData[i*166+i]=p;
for (j=i+1;j<=nCo;j++)
{
lData[i*166+j]=0;
}
}
int NInvUB=1000000;
double* NInv= new double[NInvUB+1];
NInv[0]=-1000000;
NInv[NInvUB]=1000000;
double a [4]= { 2.50662823884, -18.61500062529, 41.39119773534,
-25.44106049637 };
double b [4]= { -8.47351093090, 23.08336743743, -21.06224101826,
3.13082909833 };
double c [9]= { 0.3374754822726147, 0.9761690190917186, 0.1607979714918209,
0.0276438810333863, 0.0038405729373609, 0.0003951896511919,
0.0000321767881768, 0.0000002888167364, 0.0000003960315187 };
for (int i=1; i<NInvUB/2; i++)
{
double u = ((double) i)/NInvUB;
double x = u - 0.5;
double r;
if ((x * x) < (0.42 * 0.42)) // Beasley-Springer
{
double y = x * x;
r = x * (((a[3] * y + a[2]) * y + a[1]) * y + a[0]) /
((((b[3] * y + b[2]) * y + b[1]) * y + b[0]) * y + 1.0);
}
else // Moro
{
r = u;
if (x > 0.0)
r = 1.0 - u;
r = log(-log(r));
r = c[0] + r * (c[1] + r * (c[2] + r * (c[3] + r * (c[4] + r * (c[5] +
r * (c[6] +
r * (c[7] + r * c[8])))))));
if (x < 0.0)
r = -r;
}
NInv = r;
NInv[NInvUB-i]=-r;
}

double* Thrhold = new double[nCo];
for (int i=0;i<nCo;i++)
{
Thrhold=NInv[(int)( ProbDef*NInvUB)];
}

static double LossDist[1001];
int nRuns=100000;
double* Z= new double[nCo];
double* ZC = new double[nCo];
for (int k=0;k<nRuns;k++)//nRuns
{
for (int i=0 ;i<nCo;i++)
{
Z=NInv[(int)( ((double) rand())/32767*NInvUB)];
}
ZC[0]=Z[0]*lData[0];

double SumLoss=0;
double Zsum;
for (int i=1 ;i<nCo;i++)//nCo
{
Zsum=Z[0]*lData[i*nCo];
for (int j = 1; j <= i; j++)
{
Zsum = Zsum + Z[j] * lData[i*nCo+j];
}
ZC = Zsum * 1;
if (ZC <= Thrhold)
SumLoss = SumLoss + (1-Recovery);
}
long LR= (long) (SumLoss/0.001/nCo);
if (LR<=1000)
LossDist[LR]+=(1/(double) nRuns);
}
long aiIndex[1];
for(aiIndex[0] = 0; aiIndex[0] <= 1000; aiIndex[0]++)
{
hr=SafeArrayPutElement(*outa,aiIndex,LossDist+aiIndex[0]);
}

return LossDist[12];
}
 
A

Alon Fliess

rupert said:
i have a fairly simple bit of code which runs fine in the office in Visual
Studio C++.net but when i run it at home I get Fatal Errror C1014...too much
nesting of include statements which is odd since I only have two include
statements.

Why would it work on one Visual C++.net but not on another?

Here is the code:

#include <windows.h>
#include <math.h>
double __stdcall mc(SAFEARRAY **pp_Arg, SAFEARRAY **outa, SAFEARRAY
**RecRate, SAFEARRAY **Pdef)
{
HRESULT hr;
double* lData;
hr= SafeArrayAccessData( *pp_Arg, (void**) &lData );
SafeArrayUnaccessData(*pp_Arg);
double* Recovery;
hr= SafeArrayAccessData( *RecRate, (void**) &Recovery );
SafeArrayUnaccessData(*RecRate);
double* ProbDef;
hr= SafeArrayAccessData( *Pdef, (void**) &ProbDef );
SafeArrayUnaccessData(*Pdef);
const int nCo=165;
static double* p= new double[nCo];
int i,j,k;
double sum;
for (i=0;i<=nCo;i++) {
for (j=i;j<=nCo;j++) {
for (sum=lData[i*166+j],k=i-1;k>=0;k--) sum -=
(lData[i*166+k])*(lData[j*166+k]);
if (i == j) {
p=sqrt(sum);
} else
lData[j*166+i]=sum/p;
}
}
for (i=0;i<nCo;i++)
{
lData[i*166+i]=p;
for (j=i+1;j<=nCo;j++)
{
lData[i*166+j]=0;
}
}
int NInvUB=1000000;
double* NInv= new double[NInvUB+1];
NInv[0]=-1000000;
NInv[NInvUB]=1000000;
double a [4]= { 2.50662823884, -18.61500062529, 41.39119773534,
-25.44106049637 };
double b [4]= { -8.47351093090, 23.08336743743, -21.06224101826,
3.13082909833 };
double c [9]= { 0.3374754822726147, 0.9761690190917186, 0.1607979714918209,
0.0276438810333863, 0.0038405729373609, 0.0003951896511919,
0.0000321767881768, 0.0000002888167364, 0.0000003960315187 };
for (int i=1; i<NInvUB/2; i++)
{
double u = ((double) i)/NInvUB;
double x = u - 0.5;
double r;
if ((x * x) < (0.42 * 0.42)) // Beasley-Springer
{
double y = x * x;
r = x * (((a[3] * y + a[2]) * y + a[1]) * y + a[0]) /
((((b[3] * y + b[2]) * y + b[1]) * y + b[0]) * y + 1.0);
}
else // Moro
{
r = u;
if (x > 0.0)
r = 1.0 - u;
r = log(-log(r));
r = c[0] + r * (c[1] + r * (c[2] + r * (c[3] + r * (c[4] + r * (c[5] +
r * (c[6] +
r * (c[7] + r * c[8])))))));
if (x < 0.0)
r = -r;
}
NInv = r;
NInv[NInvUB-i]=-r;
}

double* Thrhold = new double[nCo];
for (int i=0;i<nCo;i++)
{
Thrhold=NInv[(int)( ProbDef*NInvUB)];
}

static double LossDist[1001];
int nRuns=100000;
double* Z= new double[nCo];
double* ZC = new double[nCo];
for (int k=0;k<nRuns;k++)//nRuns
{
for (int i=0 ;i<nCo;i++)
{
Z=NInv[(int)( ((double) rand())/32767*NInvUB)];
}
ZC[0]=Z[0]*lData[0];

double SumLoss=0;
double Zsum;
for (int i=1 ;i<nCo;i++)//nCo
{
Zsum=Z[0]*lData[i*nCo];
for (int j = 1; j <= i; j++)
{
Zsum = Zsum + Z[j] * lData[i*nCo+j];
}
ZC = Zsum * 1;
if (ZC <= Thrhold)
SumLoss = SumLoss + (1-Recovery);
}
long LR= (long) (SumLoss/0.001/nCo);
if (LR<=1000)
LossDist[LR]+=(1/(double) nRuns);
}
long aiIndex[1];
for(aiIndex[0] = 0; aiIndex[0] <= 1000; aiIndex[0]++)
{
hr=SafeArrayPutElement(*outa,aiIndex,LossDist+aiIndex[0]);
}

return LossDist[12];
}


Hi

Did you create a new project at home or use the one from your office?
Do you use precompiled header?
Does simple hello world application compile?

Alon Fliess
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top