Jean
07-16-2002, 05:31 PM
Hi
I am a new user of Numerical Recipes and I have some difficulties to run programs from Numerical recipes (Example Book C++) with Visual C++.
Foe example, I tried in vain to run xran.cpp (see below) from the chapter 7:random numbers.
First, I load the Numerical recipes in C++ from the CDROM in my machine.
Second, I create a workspace and a project where
I include a copy of the program xran.cpp .
Third, I modify the 5th line such that the compiler can find the file nr.h .
Fouth, I compile and everything is fine. I built and I obtained some errors.
Could anybody give me some advices?
Thanks
------------Errors----------------
Linking...
xran.obj : error LNK2001: unresolved external symbol "double __cdecl NR::ran3(int &)" (?ran3@NR@@YANAAH@Z)
xran.obj : error LNK2001: unresolved external symbol "double __cdecl NR::ran2(int &)" (?ran2@NR@@YANAAH@Z)
xran.obj : error LNK2001: unresolved external symbol "double __cdecl NR::ran1(int &)" (?ran1@NR@@YANAAH@Z)
xran.obj : error LNK2001: unresolved external symbol "double __cdecl NR::ran0(int &)" (?ran0@NR@@YANAAH@Z)
Debug/Random.exe : fatal error LNK1120: 4 unresolved externals
Error executing link.exe.
-----------xran.cpp---------------
#include <iostream>
#include <iomanip>
#include <cmath>
#include "C:\Program Files\Numerical Recipes\Cpp210\cpp\other\nr.h"
using namespace std;
// Driver for routines ran0, ran1, ran2, ran3
DP fnc(const DP x1, const DP x2, const DP x3, const DP x4)
{
return sqrt(x1*x1+x2*x2+x3*x3+x4*x4);
}
and so on.
I am a new user of Numerical Recipes and I have some difficulties to run programs from Numerical recipes (Example Book C++) with Visual C++.
Foe example, I tried in vain to run xran.cpp (see below) from the chapter 7:random numbers.
First, I load the Numerical recipes in C++ from the CDROM in my machine.
Second, I create a workspace and a project where
I include a copy of the program xran.cpp .
Third, I modify the 5th line such that the compiler can find the file nr.h .
Fouth, I compile and everything is fine. I built and I obtained some errors.
Could anybody give me some advices?
Thanks
------------Errors----------------
Linking...
xran.obj : error LNK2001: unresolved external symbol "double __cdecl NR::ran3(int &)" (?ran3@NR@@YANAAH@Z)
xran.obj : error LNK2001: unresolved external symbol "double __cdecl NR::ran2(int &)" (?ran2@NR@@YANAAH@Z)
xran.obj : error LNK2001: unresolved external symbol "double __cdecl NR::ran1(int &)" (?ran1@NR@@YANAAH@Z)
xran.obj : error LNK2001: unresolved external symbol "double __cdecl NR::ran0(int &)" (?ran0@NR@@YANAAH@Z)
Debug/Random.exe : fatal error LNK1120: 4 unresolved externals
Error executing link.exe.
-----------xran.cpp---------------
#include <iostream>
#include <iomanip>
#include <cmath>
#include "C:\Program Files\Numerical Recipes\Cpp210\cpp\other\nr.h"
using namespace std;
// Driver for routines ran0, ran1, ran2, ran3
DP fnc(const DP x1, const DP x2, const DP x3, const DP x4)
{
return sqrt(x1*x1+x2*x2+x3*x3+x4*x4);
}
and so on.