fatal error in VC++


longnx
05-02-2003, 08:59 PM
Hello,

I included some files (nr.h, nrutil.h, nrutil.c, and svdcmp.c) to call function svdcmp() in my Visual C++ program.

But when I compiled the program, I get some errors

(type 1)
float aA[101][10];
float wA[10];
float vA[10][10];

svdcmp(aA, nMatching, 9, wA, vA);
error C2665: 'svdcmp' : none of the 2 overloads can convert parameter 1 from type 'float [101][10]'

Actually, my A matrix is 100x9, but I thought that the function svdcmp() used index from 1 to 100, so I declared matrix size [101][10] to use the function.

Is this corrected?

(type 2)

nrutil.c(211) : fatal error C1010: unexpected end of file while looking for precompiled header directive

svdcmp.c(206) : fatal error C1010: unexpected end of file while looking for precompiled header directive

Can you show me how to includes Numerical Recipies C source code into Visual C++ project?

Thank you so much indeed,

Long X. Nguyen

Bill Press
05-04-2003, 09:09 PM
Actually, my A matrix is 100x9, but I thought that the function svdcmp() used index from 1 to 100, so I declared matrix size [101][10] to use the function.

No, this won't work. You have to use the NR routine "float **matrix()" to allocate the matrices. Look at pages 21 and 22 in the Numerical Recipes in C book.

By the way, if you switch to Numerical Recipes in C++, you'll find that all the routines have been converted to be zero-based rather than one-based. You may find this easier to use.

Cheers,
Bill P.