Merci beaucoup
Adrod
-------------------------------
Réponse au message :
-------------------------------
> C'est nomal tu dois implénter ta variable coefficient comme ceci en dehors de la définition de la classe:
>
> int COperPixels::coefficient= valeur_initiale;
>
>
Core Breaker 
>
>
> -------------------------------
> Réponse au message :
> -------------------------------
>
> > En fait ma fonction doit être static donc il ne reste qu'une solution. Mais si je mets ma variable en static cela me met une erreur lors du "linking":
> > OperationsPixels.obj : error LNK2001: unresolved external symbol "private: static int COperPixels::coefficient" (?coefficient@COperPixels@@1HA)
> > "coefficient" étant la variable remplacant "i" que j'ai mis dans l'exemple et "COperPixels" étant la classe.
> > Y a t'il une autre solution?
> > Adrod
> >
> >
> > -------------------------------
> > Réponse au message :
> > -------------------------------
> >
> > > Il y a 3 corrections possibles:
> > >
> > > 1.
> > > class s1 { // in cpp file > > > void func(); > > > int i; > > > }; > > > > > > void s1::func() > > > { > > > i = 1; // C2597 here > > > } > > > > > > |
> > >
> > > 2.
> > > class s1 { // in cpp file > > > void func(); > > > static int i; > > > }; > > > > > > void s1::func() > > > { > > > i = 1; // C2597 here > > > } > > > > > > |
> > >
> > > 3.
> > > class s1 { // in cpp file > > > static void func(); > > > static int i; > > > }; > > > > > > void s1::func() > > > { > > > i = 1; // C2597 here > > > } > > > > > > |
> > >
Core Breaker 
> > >
> > >
> > > -------------------------------
> > > Réponse au message :
> > > -------------------------------
> > >
> > > > J'ai une erreur du compilateur: Error C2597. Je suis allé sur msdn pour avoir plus de précision et ils me disent:
> > > >
> > > > To access the nonstatic member, you must create an instance of the class and use a member-access operator (. or ->).
> > > >
> > > > // Exemple avec l'erreur
> > > > class s1 { // in cpp file
> > > > static void func();
> > > > int i;
> > > > };
> > > >
> > > > void s1::func()
> > > > {
> > > > i = 1; // C2597 here
> > > > }
> > > >
> > > > Est-ce que quelqu'un pour me dire comment il faut faire exactement? Je ne comprend pas vraiment pourquoi cela fait une erreur. Si quelqu'un a une explication je suis preneur! Merci d'avance,
> > > > Adrod
> > > >
> > >
> >
>