expected unqualified-id before ‘namespace’
Bonjour à tous, Je suis débutant en c++.
Mon progamme c++ se nomme point1.cpp.
Est ce que quelqu'un a compris ce type de message d'erreur à la compilation.
In file included from /usr/include/c++/4.3/iostream:44,
from point1.cpp:2:
/usr/include/c++/4.3/i486-linux-gnu/bits/c++config.h:233: erreur: expected unqualified-id before ‘namespace’
Code:
1 2 3 4 5 6 7 8 9
| ------------------------------------------------ point1.h ---------------------------------------
class point
{
float x, y;
public :
point(float, float);
void deplace(float, float);
void affiche();
} |
Code:
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
| ------------------------------------------------------ point1.cpp ----------------------------------------------------------
#include "point1.h"
#include <iostream>
point::point(float abs, float ord)
{
x = abs;
y = ord;
}
void point::deplace(float dx, float dy)
{
x = x + dx;
y = y + dy;
}
void point::affiche()
{
std::cout << "Mes coordonnees cartesiennes sont :" <<"x = " << x << "\ty = " << y << "\n";
}
main()
{
point p(1.25, 2.5);
p.affiche();
p.deplace(2.1, 3.4);
p.affiche();
} |