Bonjour, je suis entrain de debuger un programme qui me donne un message d'erreur que je n'arrive pas a résoudre.

Ci-dessous le message d'erreur recu et les codes concerner :

1>Édition des liens en cours...
1>testBSPDE1.obj : error LNK2005: "double (__cdecl* BlackScholesOneFactorIBVP::sigma)(double,double)" (?sigma@BlackScholesOneFactorIBVP@@3P6ANNN@ZA) déjà défini(e) dans FDMDirector.obj
1>testBSPDE1.obj : error LNK2005: "double (__cdecl* BlackScholesOneFactorIBVP::f)(double,double)" (?f@BlackScholesOneFactorIBVP@@3P6ANNN@ZA) déjà défini(e) dans FDMDirector.obj
1>testBSPDE1.obj : error LNK2005: "double (__cdecl* BlackScholesOneFactorIBVP::mu)(double,double)" (?mu@BlackScholesOneFactorIBVP@@3P6ANNN@ZA) déjà défini(e) dans FDMDirector.obj
1>testBSPDE1.obj : error LNK2005: "double (__cdecl* BlackScholesOneFactorIBVP::IC)(double)" (?IC@BlackScholesOneFactorIBVP@@3P6ANN@ZA) déjà défini(e) dans FDMDirector.obj
1>testBSPDE1.obj : error LNK2005: "double (__cdecl* BlackScholesOneFactorIBVP::BCR)(double)" (?BCR@BlackScholesOneFactorIBVP@@3P6ANN@ZA) déjà défini(e) dans FDMDirector.obj
1>testBSPDE1.obj : error LNK2005: "double (__cdecl* BlackScholesOneFactorIBVP::BCL)(double)" (?BCL@BlackScholesOneFactorIBVP@@3P6ANN@ZA) déjà défini(e) dans FDMDirector.obj
1>testBSPDE1.obj : error LNK2005: "double (__cdecl* BlackScholesOneFactorIBVP::b)(double,double)" (?b@BlackScholesOneFactorIBVP@@3P6ANNN@ZA) déjà défini(e) dans FDMDirector.obj
1>C:\sphere369\DistanceLearning\Code\Part1_Cpp_Essential_Skills\Debug\Chap10_BSPDE1.exe : fatal error LNK1169: un ou plusieurs symboles définis à différentes reprises ont été rencontrés
1>Le journal de génération a été enregistré à l'emplacement "file://c:\sphere369\DistanceLearning\Code\Part1_Cpp_Essential_Skills\Chap10_BSPDE1\Debug\BuildLog.htm"
1>Chap10_BSPDE1 - 8 erreur(s), 2 avertissement(s)

testBSDE1.cpp :
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
 
#include "fdmdirector.cpp"
#include "arraymechanisms.cpp"
 
#include <iostream>
#include <string>
using namespace std;
 
#include "ExcelDriver.hpp"
 
void printOneExcel(Vector<double, long> & x,						
					Vector<double, long>& functionResult,
					string& title)
{ 
	// N.B. Excel has a limit of 8 charts; after that you get a run-time error
 
	cout << "Starting Excel\n";
 
	ExcelDriver & excel = ExcelDriver::Instance();
 
	excel.MakeVisible(true);		// Default is INVISIBLE!
 
	excel.CreateChart(x, functionResult, title, "X", "Y");
 
 
}
 
// Excel output as well
void printInExcel(const Vector<double, long>& x,							// X array
					const list<string>& labels,							// Names of each vector
					const list<Vector<double, long> >& functionResult)	// The list of Y values
{ // Print a list of Vectors in Excel. Each vector is the output of
  // a finite difference scheme for a scalar IVP
 
	cout << "Starting Excel\n";
 
	ExcelDriver & excel = ExcelDriver::Instance();
 
	excel.MakeVisible(true);		// Default is INVISIBLE!
 
 
	// Don't make the string names too long!!
	excel.CreateChart(x, labels, functionResult, string("FDM Scalar IVP"),
						string("Time Axis"), string ("Value"));
 
 
}
 
 
 
double mySigma (double x, double t)
{
 
	double sigmaS = 0.30 * 0.30;
 
	return 0.5 * sigmaS * x * x;
}
 
double myMu (double x, double t)
{
	double r = 0.06;
	double D = 0.00;
 
	return (r - D) * x;
}
 
double myB (double x, double t)
{
	double r = 0.06;
 
	return  -r;
}
 
double myF (double x, double t)
{
	return 0.0;
}
 
double myBCL (double t)
{
 //return 0.0; // C
 
	double K = 10;
	double r = 0.06;
	double T = 1.0;
	return K * ::exp(-r * (T - t));
}
 
double myBCR (double t)
{
	double Smax = 100;
//	return Smax;
 
 
	return 0.0; // P
}
 
double myIC (double x)
{
	double K = 10;
 
	if (x < K)
		return -(x - K);
 
	return 0.0;
 
}
 
 
int main()
{
	using namespace BlackScholesOneFactorIBVP;
 
	// Assignment of functions
	sigma = mySigma;
	mu = myMu;
	b = myB;
	f = myF;
	BCL = myBCL;
	BCR = myBCR;
	IC = myIC;
 
	double T = 1.0;	int J= 200; int N = 4000-1;
	double Smax = 100.0;
	FDMDirector fdir(Smax, T, J, N);
	fdir.Start();
 
L1:
	fdir.doit();
	//	print(fdir.current());
 
	if (fdir.isDone() == false)
		goto L1;
 
	Vector<double, long> xresult(J+1, 1);
	xresult[xresult.MinIndex()] = 0.0;
	double h = Smax / (double) (J);
 
	for (long j = xresult.MinIndex()+1; j <= xresult.MaxIndex(); j++)
	{
			xresult[j] = xresult[j-1] + h;
	}
 
	print (xresult);
	//print(fdir.current());
 
	printOneExcel(xresult, fdir.current(), string("Value"));
 
	return 0;
}
FDMDirector.cpp :

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
#ifndef FDMDirector_CPP
#define FDMDirector_CPP
 
#include "mesher.cpp"
#include "fdm.cpp"
#include "arraymechanisms.cpp"
 
#include <iostream>
using namespace std;
 
class FDMDirector
{
 
private:
	FDMDirector ()
	{
 
 
	}
 
public:
 
	double T;
	double Xmax;
 
	double k;
	long J, N;
	double tprev, tnow;
	Mesher m;
	Vector<double, long> xarr; // Useful work array
	FDM fdm;
 
	FDMDirector (double XM, double TM, long JSteps, long NSteps)
	{
 
		T = TM;
		J = JSteps;
		N = NSteps;
		Xmax = XM;
		tprev = tnow = 0.0;
		fdm = FDM();
 
		m = Mesher(0.0, XM, T);
	}
 
 
	Vector<double, long> current()
	{
		return fdm.current();
	}
 
	void Start() // Calculate next level
	{
		// Steps 1, 2: Get stuff from Mesher
		k = m.timeStep(N);
		xarr = m.xarr(J);
 
		cout << "k, xarr\n";
		cout << k << endl;
 
		// Step 3: Update new mesh array in FDM scheme
		fdm.initIC(xarr);
 
	}
 
	void doit()
	{
		// Step 4, 5: Get new coefficient arrays + solve
 
		tnow = tprev + k;
		fdm.calculateCoefficients(xarr, tprev, tnow);
		fdm.solve(tnow);
		tprev += k;
	}
 
 
	bool isDone()
	{
		if (tnow < T)
		{
			return false;
		}
 
		cout << "done";
		return true;
	}
};
 
#endif