Bonjour,
Dans mon Programme j'ai créer une méthode (fonction) GetXPoint() pour obtenir ici 1 coordonné d'un point dans la classe point voici le code :

mon Point.h
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
 
#include <iostream>
#include<math.h>
#include<stdlib.h>
#include<string>
 
using namespace std;
 
class Point{
 
	private:
		int x;
		int y;
		string name;
 
	public:
		Point();
		Point(string,int,int);
		void GetPoint();
		void GetXPoint();		
		void SetXPoint(int);
		void SetYPoint(int);
 
 
};
mon Point.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
 
 
#include "Point.h"
#include <iostream>
#include<math.h>
#include<stdlib.h>
#include<string>
using namespace std;
 
Point::Point()
{
	x=0;
	y=0;
	name= "toto";
}
 
Point::Point(string nom ,int x_x , int y_y )
{
	name= nom;
	x=x_x;//initialisation d'un point par defaut
	y=y_y;
}
 
void Point::GetPoint()
{
	cout<< "Point:" << name << endl;
	cout<< "x=" << x << endl;
	cout<< "y=" << y << endl;
}
 
 
void Point::GetXPoint()
{
	return x;
} 
 
void Point::SetXPoint(int x_x )
{ 
	x=x_x;
}
void Point::SetYPoint(int y_y)
{
	y=y_y;
}
J'ai créer un fichier main.cpp mais l'erreur ne viens pas de là

voici ce que répond mon terminale :

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
 
bruno@ubuntu:/media/DATA/L3/Semestre 5/INF1508C++/TP03$ g++ -o test  Point.h Point.cpp main.cpp 
Point.cpp:33: error: no ‘void Point::GetXPoint()’ member function declared in class ‘Point’
je ne vois pas ou est l'erreur puisque cette fonction est créer dans la classe Point et je l'aie bien définie dans mon Point.h
j'ai testé plein de truc c'est la même erreur qui revien uniquement sur cette fonction ...