Bonjour, j'ai le code suivant :
le fichier .h :
fichier .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 #ifndef TOTO_H_20100116_ #define TOTO_H_20100116_ #include <vector> namespace Toto { class MonToto { public : static int fit(std::vector<double> & c,double w,double (*f)(std::vector<double> & param)); static double _alpha; /* coefficient de reflexion : la valeur par defaut est 1 */ }; } #endif
et là, pour _alpha, j'ai le warning suivant :
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9 #include "Toto.h" static double Toto::MonToto::_alpha = 1.; static int Toto::MonToto::fit(vector<double> & c,double w,double (*f)(vector<double> & param)) { blabla; }
et pour la fonction fit(), le warning suivant :warning: `static' may not be used when defining
(as opposed to declaring) a static data member
Pourquoi de tels warnings ? Comment les supprimer ?warning: cannot declare member function `static
int Toto::MonToto::fit(std::vector<double,
std::allocator<double> >&, double, double (*)(std::vector<double,
std::allocator<double> >&))' to have static linkage
Merci d'avance
Partager