Classe Pile en c++

Fermé
samsouma04 Messages postés 60 Date d'inscription samedi 26 juillet 2008 Statut Membre Dernière intervention 17 mai 2009 - 5 janv. 2009 à 20:55
samsouma04 Messages postés 60 Date d'inscription samedi 26 juillet 2008 Statut Membre Dernière intervention 17 mai 2009 - 13 janv. 2009 à 19:16
Bonjour,
je programme avc visual studio C++ (MFC) voici le code de ma classe pile.cpp
// Pile.cpp: implementation of the Pile class.
//
/////////////////////////////////////////////////////////////////////
#include "Pile.h"
#include "Noeud.h"
#include "stdafx.h"
#include "iostream.h"
#include "String.h"

#ifdef _DEBUG
#undef THIS_FILE
static char THIS_FILE[]=__FILE__;
#define new DEBUG_NEW
#endif

//////////////////////////////////////////////////////////////////////
// Construction/Destruction
//////////////////////////////////////////////////////////////////////

Pile::Pile()
{
head = NULL;
}

Pile::~Pile()
{
Noeud *n = head;
while(n!=NULL)
{
head = head->next;
delete n;
n=head;
}
}

bool Pile::vide()
{
return (head == NULL);
}

void Pile::push(int e)
{
head = new Noeud(e,head);
}

bool Pile::pop(int &e)
{
if(vide())
{
return false;
}
Noeud *n = head;
e = n->val;
head = head->next;
delete n;
return true;
}

jai declaré aussi une classe Noeud et voici son code
// Noeud.cpp: implementation of the Noeud class.
//
//////////////////////////////////////////////////////////////////////

#include "Noeud.h"
#include "stdafx.h"
#include "iostream.h"
#include "String.h"
#include "Pile.h"


#ifdef _DEBUG
#undef THIS_FILE
static char THIS_FILE[]=__FILE__;
#define new DEBUG_NEW
#endif
//////////////////////////////////////////////////////////////////////
// Construction/Destruction
//////////////////////////////////////////////////////////////////////

Noeud::Noeud(int e,Noeud *n)
{
val = e;
next = n;

}

Noeud::~Noeud()
{
}


et voici la liste des erreurs
Pile.cpp
C:\Documents and Settings\Soumaya\Bureau\compile\essay\Pile.cpp(20) : error C2653: 'Pile' : is not a class or namespace name
C:\Documents and Settings\Soumaya\Bureau\compile\essay\Pile.cpp(22) : error C2065: 'head' : undeclared identifier
C:\Documents and Settings\Soumaya\Bureau\compile\essay\Pile.cpp(23) : warning C4508: 'Pile' : function should return a value; 'void' return type assumed
C:\Documents and Settings\Soumaya\Bureau\compile\essay\Pile.cpp(25) : error C2653: 'Pile' : is not a class or namespace name
C:\Documents and Settings\Soumaya\Bureau\compile\essay\Pile.cpp(26) : error C2084: function 'int __cdecl Pile(void)' already has a body
C:\Documents and Settings\Soumaya\Bureau\compile\essay\Pile.cpp(27) : error C2065: 'Noeud' : undeclared identifier
C:\Documents and Settings\Soumaya\Bureau\compile\essay\Pile.cpp(27) : error C2065: 'n' : undeclared identifier
C:\Documents and Settings\Soumaya\Bureau\compile\essay\Pile.cpp(27) : error C2106: '=' : left operand must be l-value
C:\Documents and Settings\Soumaya\Bureau\compile\essay\Pile.cpp(30) : error C2227: left of '->next' must point to class/struct/union
C:\Documents and Settings\Soumaya\Bureau\compile\essay\Pile.cpp(31) : error C2541: delete : cannot delete objects that are not pointers
C:\Documents and Settings\Soumaya\Bureau\compile\essay\Pile.cpp(36) : error C2653: 'Pile' : is not a class or namespace name
C:\Documents and Settings\Soumaya\Bureau\compile\essay\Pile.cpp(41) : error C2653: 'Pile' : is not a class or namespace name
C:\Documents and Settings\Soumaya\Bureau\compile\essay\Pile.cpp(43) : error C2061: syntax error : identifier 'Noeud'
C:\Documents and Settings\Soumaya\Bureau\compile\essay\Pile.cpp(44) : error C2143: syntax error : missing ';' before '}'
C:\Documents and Settings\Soumaya\Bureau\compile\essay\Pile.cpp(44) : error C2143: syntax error : missing ';' before '}'
C:\Documents and Settings\Soumaya\Bureau\compile\essay\Pile.cpp(44) : error C2143: syntax error : missing ';' before '}'
C:\Documents and Settings\Soumaya\Bureau\compile\essay\Pile.cpp(44) : error C2143: syntax error : missing ';' before '}'
C:\Documents and Settings\Soumaya\Bureau\compile\essay\Pile.cpp(44) : error C2143: syntax error : missing ';' before '}'
C:\Documents and Settings\Soumaya\Bureau\compile\essay\Pile.cpp(44) : error C2143: syntax error : missing ';' before '}'
C:\Documents and Settings\Soumaya\Bureau\compile\essay\Pile.cpp(44) : error C2143: syntax error : missing ';' before '}'
C:\Documents and Settings\Soumaya\Bureau\compile\essay\Pile.cpp(44) : error C2143: syntax error : missing ';' before '}'
C:\Documents and Settings\Soumaya\Bureau\compile\essay\Pile.cpp(44) : error C2143: syntax error : missing ';' before '}'
C:\Documents and Settings\Soumaya\Bureau\compile\essay\Pile.cpp(44) : error C2143: syntax error : missing ';' before '}'
C:\Documents and Settings\Soumaya\Bureau\compile\essay\Pile.cpp(44) : error C2143: syntax error : missing ';' before '}'
C:\Documents and Settings\Soumaya\Bureau\compile\essay\Pile.cpp(44) : error C2143: syntax error : missing ';' before '}'
C:\Documents and Settings\Soumaya\Bureau\compile\essay\Pile.cpp(44) : error C2143: syntax error : missing ';' before '}'
C:\Documents and Settings\Soumaya\Bureau\compile\essay\Pile.cpp(44) : error C2143: syntax error : missing ';' before '}'
C:\Documents and Settings\Soumaya\Bureau\compile\essay\Pile.cpp(44) : error C2143: syntax error : missing ';' before '}'
C:\Documents and Settings\Soumaya\Bureau\compile\essay\Pile.cpp(44) : error C2143: syntax error : missing ';' before '}'
C:\Documents and Settings\Soumaya\Bureau\compile\essay\Pile.cpp(44) : error C2143: syntax error : missing ';' before '}'
C:\Documents and Settings\Soumaya\Bureau\compile\essay\Pile.cpp(44) : error C2143: syntax error : missing ';' before '}'
C:\Documents and Settings\Soumaya\Bureau\compile\essay\Pile.cpp(44) : error C2143: syntax error : missing ';' before '}'
C:\Documents and Settings\Soumaya\Bureau\compile\essay\Pile.cpp(44) : error C2143: syntax error : missing ';' before '}'
C:\Documents and Settings\Soumaya\Bureau\compile\essay\Pile.cpp(44) : error C2143: syntax error : missing ';' before '}'
C:\Documents and Settings\Soumaya\Bureau\compile\essay\Pile.cpp(44) : error C2143: syntax error : missing ';' before '}'
C:\Documents and Settings\Soumaya\Bureau\compile\essay\Pile.cpp(44) : error C2143: syntax error : missing ';' before '}'
C:\Documents and Settings\Soumaya\Bureau\compile\essay\Pile.cpp(44) : error C2143: syntax error : missing ';' before '}'
C:\Documents and Settings\Soumaya\Bureau\compile\essay\Pile.cpp(44) : error C2143: syntax error : missing ';' before '}'
C:\Documents and Settings\Soumaya\Bureau\compile\essay\Pile.cpp(44) : error C2143: syntax error : missing ';' before '}'
C:\Documents and Settings\Soumaya\Bureau\compile\essay\Pile.cpp(44) : error C2143: syntax error : missing ';' before '}'
C:\Documents and Settings\Soumaya\Bureau\compile\essay\Pile.cpp(44) : error C2143: syntax error : missing ';' before '}'
C:\Documents and Settings\Soumaya\Bureau\compile\essay\Pile.cpp(44) : error C2143: syntax error : missing ';' before '}'
C:\Documents and Settings\Soumaya\Bureau\compile\essay\Pile.cpp(44) : error C2143: syntax error : missing ';' before '}'
C:\Documents and Settings\Soumaya\Bureau\compile\essay\Pile.cpp(44) : error C2143: syntax error : missing ';' before '}'
C:\Documents and Settings\Soumaya\Bureau\compile\essay\Pile.cpp(44) : error C2143: syntax error : missing ';' before '}'
C:\Documents and Settings\Soumaya\Bureau\compile\essay\Pile.cpp(44) : error C2143: syntax error : missing ';' before '}'
C:\Documents and Settings\Soumaya\Bureau\compile\essay\Pile.cpp(44) : error C2143: syntax error : missing ';' before '}'
C:\Documents and Settings\Soumaya\Bureau\compile\essay\Pile.cpp(44) : error C2143: syntax error : missing ';' before '}'
C:\Documents and Settings\Soumaya\Bureau\compile\essay\Pile.cpp(44) : error C2143: syntax error : missing ';' before '}'
C:\Documents and Settings\Soumaya\Bureau\compile\essay\Pile.cpp(44) : error C2143: syntax error : missing ';' before '}'
C:\Documents and Settings\Soumaya\Bureau\compile\essay\Pile.cpp(44) : error C2143: syntax error : missing ';' before '}'
C:\Documents and Settings\Soumaya\Bureau\compile\essay\Pile.cpp(44) : error C2143: syntax error : missing ';' before '}'
C:\Documents and Settings\Soumaya\Bureau\compile\essay\Pile.cpp(44) : error C2143: syntax error : missing ';' before '}'
C:\Documents and Settings\Soumaya\Bureau\compile\essay\Pile.cpp(44) : error C2143: syntax error : missing ';' before '}'
C:\Documents and Settings\Soumaya\Bureau\compile\essay\Pile.cpp(44) : error C2143: syntax error : missing ';' before '}'
C:\Documents and Settings\Soumaya\Bureau\compile\essay\Pile.cpp(44) : error C2143: syntax error : missing ';' before '}'
C:\Documents and Settings\Soumaya\Bureau\compile\essay\Pile.cpp(44) : error C2143: syntax error : missing ';' before '}'
C:\Documents and Settings\Soumaya\Bureau\compile\essay\Pile.cpp(44) : error C2143: syntax error : missing ';' before '}'
C:\Documents and Settings\Soumaya\Bureau\compile\essay\Pile.cpp(44) : error C2143: syntax error : missing ';' before '}'
C:\Documents and Settings\Soumaya\Bureau\compile\essay\Pile.cpp(44) : error C2143: syntax error : missing ';' before '}'
C:\Documents and Settings\Soumaya\Bureau\compile\essay\Pile.cpp(44) : error C2143: syntax error : missing ';' before '}'
C:\Documents and Settings\Soumaya\Bureau\compile\essay\Pile.cpp(44) : error C2143: syntax error : missing ';' before '}'
C:\Documents and Settings\Soumaya\Bureau\compile\essay\Pile.cpp(44) : error C2143: syntax error : missing ';' before '}'
C:\Documents and Settings\Soumaya\Bureau\compile\essay\Pile.cpp(44) : error C2143: syntax error : missing ';' before '}'
C:\Documents and Settings\Soumaya\Bureau\compile\essay\Pile.cpp(44) : error C2143: syntax error : missing ';' before '}'
C:\Documents and Settings\Soumaya\Bureau\compile\essay\Pile.cpp(44) : error C2143: syntax error : missing ';' before '}'
C:\Documents and Settings\Soumaya\Bureau\compile\essay\Pile.cpp(44) : error C2143: syntax error : missing ';' before '}'
C:\Documents and Settings\Soumaya\Bureau\compile\essay\Pile.cpp(44) : error C2143: syntax error : missing ';' before '}'
C:\Documents and Settings\Soumaya\Bureau\compile\essay\Pile.cpp(44) : error C2143: syntax error : missing ';' before '}'
C:\Documents and Settings\Soumaya\Bureau\compile\essay\Pile.cpp(44) : error C2143: syntax error : missing ';' before '}'
C:\Documents and Settings\Soumaya\Bureau\compile\essay\Pile.cpp(44) : error C2143: syntax error : missing ';' before '}'
C:\Documents and Settings\Soumaya\Bureau\compile\essay\Pile.cpp(44) : error C2143: syntax error : missing ';' before '}'
C:\Documents and Settings\Soumaya\Bureau\compile\essay\Pile.cpp(44) : error C2143: syntax error : missing ';' before '}'
C:\Documents and Settings\Soumaya\Bureau\compile\essay\Pile.cpp(44) : error C2143: syntax error : missing ';' before '}'
C:\Documents and Settings\Soumaya\Bureau\compile\essay\Pile.cpp(44) : error C2143: syntax error : missing ';' before '}'
C:\Documents and Settings\Soumaya\Bureau\compile\essay\Pile.cpp(44) : error C2143: syntax error : missing ';' before '}'
C:\Documents and Settings\Soumaya\Bureau\compile\essay\Pile.cpp(44) : error C2143: syntax error : missing ';' before '}'
C:\Documents and Settings\Soumaya\Bureau\compile\essay\Pile.cpp(44) : error C2143: syntax error : missing ';' before '}'
C:\Documents and Settings\Soumaya\Bureau\compile\essay\Pile.cpp(44) : error C2143: syntax error : missing ';' before '}'
C:\Documents and Settings\Soumaya\Bureau\compile\essay\Pile.cpp(44) : error C2143: syntax error : missing ';' before '}'
C:\Documents and Settings\Soumaya\Bureau\compile\essay\Pile.cpp(44) : error C2143: syntax error : missing ';' before '}'
C:\Documents and Settings\Soumaya\Bureau\compile\essay\Pile.cpp(44) : error C2143: syntax error : missing ';' before '}'
C:\Documents and Settings\Soumaya\Bureau\compile\essay\Pile.cpp(44) : error C2143: syntax error : missing ';' before '}'
C:\Documents and Settings\Soumaya\Bureau\compile\essay\Pile.cpp(44) : error C2143: syntax error : missing ';' before '}'
C:\Documents and Settings\Soumaya\Bureau\compile\essay\Pile.cpp(44) : error C2143: syntax error : missing ';' before '}'
C:\Documents and Settings\Soumaya\Bureau\compile\essay\Pile.cpp(44) : error C2143: syntax error : missing ';' before '}'
C:\Documents and Settings\Soumaya\Bureau\compile\essay\Pile.cpp(44) : error C2143: syntax error : missing ';' before '}'
C:\Documents and Settings\Soumaya\Bureau\compile\essay\Pile.cpp(44) : error C2143: syntax error : missing ';' before '}'
C:\Documents and Settings\Soumaya\Bureau\compile\essay\Pile.cpp(44) : error C2143: syntax error : missing ';' before '}'
C:\Documents and Settings\Soumaya\Bureau\compile\essay\Pile.cpp(44) : error C2143: syntax error : missing ';' before '}'
C:\Documents and Settings\Soumaya\Bureau\compile\essay\Pile.cpp(44) : error C2143: syntax error : missing ';' before '}'
C:\Documents and Settings\Soumaya\Bureau\compile\essay\Pile.cpp(44) : error C2143: syntax error : missing ';' before '}'
C:\Documents and Settings\Soumaya\Bureau\compile\essay\Pile.cpp(44) : error C2143: syntax error : missing ';' before '}'
C:\Documents and Settings\Soumaya\Bureau\compile\essay\Pile.cpp(44) : error C2143: syntax error : missing ';' before '}'
C:\Documents and Settings\Soumaya\Bureau\compile\essay\Pile.cpp(44) : error C2143: syntax error : missing ';' before '}'
C:\Documents and Settings\Soumaya\Bureau\compile\essay\Pile.cpp(44) : error C2143: syntax error : missing ';' before '}'
C:\Documents and Settings\Soumaya\Bureau\compile\essay\Pile.cpp(44) : error C2143: syntax error : missing ';' before '}'
C:\Documents and Settings\Soumaya\Bureau\compile\essay\Pile.cpp(44) : error C2143: syntax error : missing ';' before '}'
C:\Documents and Settings\Soumaya\Bureau\compile\essay\Pile.cpp(44) : error C2143: syntax error : missing ';' before '}'
C:\Documents and Settings\Soumaya\Bureau\compile\essay\Pile.cpp(44) : error C2143: syntax error : missing ';' before '}'
C:\Documents and Settings\Soumaya\Bureau\compile\essay\Pile.cpp(44) : error C2143: syntax error : missing ';' before '}'
C:\Documents and Settings\Soumaya\Bureau\compile\essay\Pile.cpp(44) : error C2143: syntax error : missing ';' before '}'
C:\Documents and Settings\Soumaya\Bureau\compile\essay\Pile.cpp(44) : fatal error C1003: error count exceeds 100; stopping compilation
Error executing cl.exe.

application.exe - 102 error(s), 1 warning(s)

Je me plante.merci pr votre aide

12 réponses

samsouma04 Messages postés 60 Date d'inscription samedi 26 juillet 2008 Statut Membre Dernière intervention 17 mai 2009 1
5 janv. 2009 à 21:48
merci pr ta rep.voici le Pile.h
// Pile.h: interface for the Pile class.
//
//////////////////////////////////////////////////////////////////////

#if !defined(AFX_PILE_H__C1970CCD_DD33_4EF3_850B_2FD2190FAE4F__INCLUDED_)
#define AFX_PILE_H__C1970CCD_DD33_4EF3_850B_2FD2190FAE4F__INCLUDED_

#if _MSC_VER >= 1000
#pragma once
#endif // _MSC_VER >= 1000

#include "Noeud.h"
#include "Pile.h"
#include <stdlib.h>
#include<stdio.h>

class Pile
{
private:
Noeud *head;
public:
Pile();
virtual ~Pile();
bool vide();
bool pop(int &);
void push(int);
};

#endif // !defined(AFX_PILE_H__C1970CCD_DD33_4EF3_850B_2FD2190FAE4F__INCLUDED_)

Mais ttes les erreurs sont declarées au niveau du cpp!!!!
merci encore une fois
1
Oui les erreurs sont trouvées dans le 'Pile.cpp', mais il y inclue le fichier 'Pile.h'.
Or, manisfestement, dans le 'Pile.cpp', il ne reconnait pas la classe 'Pile'.
Je travaille sous Linux et je ne sais pas que vaut le #if !defined(AFX_PILE_H__...
Si cette valeur est définie, il y aura saut directement au #endif (c'est-à-dire à la fin du fichier) et donc rien n'est inclus dans le 'Pile.cpp' et 'Pile.cpp' n'aura pas la définition de la classe.
D'autre part, dans le 'Pile.h', il y a un 'Pile.h'; ceci est illogique mais ça ne change rien.
En général, on code ainsi:
#ifndef PILE_H
#define PILE_H

class Pile
{
   ...
};

#endif
0
Le problème se trouve probablement dans le fichier 'Pile.h'
0
samsouma04 Messages postés 60 Date d'inscription samedi 26 juillet 2008 Statut Membre Dernière intervention 17 mai 2009 1
5 janv. 2009 à 22:08
merci bcp tu m'a mis sur une piste.l'idée est encore floue je vais essayer de voir comment ca marchera.
0
samsouma04 Messages postés 60 Date d'inscription samedi 26 juillet 2008 Statut Membre Dernière intervention 17 mai 2009 1
6 janv. 2009 à 15:55
jai changé le code en
// Pile.h: interface for the Pile class.
//
//////////////////////////////////////////////////////////////////////
/*
#if !defined(AFX_PILE_H__C1970CCD_DD33_4EF3_850B_2FD2190FAE4F__INCLUDED_)
#define AFX_PILE_H__C1970CCD_DD33_4EF3_850B_2FD2190FAE4F__INCLUDED_
*/
#ifndef PILE_H
#define PILE_H
#if _MSC_VER >= 1000
#pragma once
#endif // _MSC_VER >= 1000



#include "Noeud.h"
#include "Pile.h"
#include <stdlib.h>
#include<stdio.h>

class Pile
{
private:
Noeud *head;
public:
Pile();
virtual ~Pile();
bool vide();
bool pop(int &);
void push(int);
};
#endif
//#endif // !defined(AFX_PILE_H__C1970CCD_DD33_4EF3_850B_2FD2190FAE4F__INCLUDED_)
Et ca ne marche pas encore:-(
0
Donne les 10 premières lignes des erreurs.
0

Vous n’avez pas trouvé la réponse que vous recherchez ?

Posez votre question
samsouma04 Messages postés 60 Date d'inscription samedi 26 juillet 2008 Statut Membre Dernière intervention 17 mai 2009 1
6 janv. 2009 à 16:36
C:\Documents and Settings\Soumaya\Bureau\compile\essay\Pile.cpp(20) : error C2653: 'Pile' : is not a class or namespace name
C:\Documents and Settings\Soumaya\Bureau\compile\essay\Pile.cpp(22) : error C2065: 'head' : undeclared identifier
C:\Documents and Settings\Soumaya\Bureau\compile\essay\Pile.cpp(23) : warning C4508: 'Pile' : function should return a value; 'void' return type assumed
C:\Documents and Settings\Soumaya\Bureau\compile\essay\Pile.cpp(25) : error C2653: 'Pile' : is not a class or namespace name
C:\Documents and Settings\Soumaya\Bureau\compile\essay\Pile.cpp(26) : error C2084: function 'int __cdecl Pile(void)' already has a body
C:\Documents and Settings\Soumaya\Bureau\compile\essay\Pile.cpp(27) : error C2065: 'Noeud' : undeclared identifier
C:\Documents and Settings\Soumaya\Bureau\compile\essay\Pile.cpp(27) : error C2065: 'n' : undeclared identifier
C:\Documents and Settings\Soumaya\Bureau\compile\essay\Pile.cpp(27) : error C2106: '=' : left operand must be l-value
C:\Documents and Settings\Soumaya\Bureau\compile\essay\Pile.cpp(30) : error C2227: left of '->next' must point to class/struct/union
C:\Documents and Settings\Soumaya\Bureau\compile\essay\Pile.cpp(31) : error C2541: delete : cannot delete objects that are not pointers
C:\Documents and Settings\Soumaya\Bureau\compile\essay\Pile.cpp(36) : error C2653: 'Pile' : is not a class or namespace name
C:\Documents and Settings\Soumaya\Bureau\compile\essay\Pile.cpp(41) : error C2653: 'Pile' : is not a class or namespace name
0
Char Snipeur Messages postés 9696 Date d'inscription vendredi 23 avril 2004 Statut Contributeur Dernière intervention 3 octobre 2023 1 297
6 janv. 2009 à 16:42
hum...
Petite idée à la ocn, essai de renommer Pile en autre chose.
En général, pour comprendre ce genre de problème, il faut simplifier : copie le .h dans le .cpp et vire toute les directives de précompilation, include compris.
0
samsouma04 Messages postés 60 Date d'inscription samedi 26 juillet 2008 Statut Membre Dernière intervention 17 mai 2009 1
6 janv. 2009 à 16:44
jai fais une petite recherche sur le net et le #if !defined(AFX.....) et jai trouvé ceci
Re: #if !defined(AFX_

In all my old generated code all the header files start with
#if !defined(AFX_ etc and long hex string. With later versions of VS
such lines are produced. If I comment some out they don't seem to be
needed any longer.

What were they for?


I think they are "header guards" to avoid multiple #include's of the same
header more than one time during a compilation.

In modern C++ you may use the #pragma once directive, even if I'm not sure
if #pragma once is perfectly equivalent to the #ifndef... header guards...



Mistake: I should have said, "With later versions of VS such lines are

not<< produced." So the mystery is how does the build avoid

multiple includes without them?


The long hex string must be a Globally Unique IDentifier (GUID), to uniquely
identify the given header.



I realised they were probably a GUID but it's purpose was not obvious
to me.

Merci loupius:-)
0
samsouma04 Messages postés 60 Date d'inscription samedi 26 juillet 2008 Statut Membre Dernière intervention 17 mai 2009 1
6 janv. 2009 à 16:49
slt Char Snipeur daccord jvé voir.merci bcp
0
samsouma04 Messages postés 60 Date d'inscription samedi 26 juillet 2008 Statut Membre Dernière intervention 17 mai 2009 1
6 janv. 2009 à 17:02
enfait la classe piles .h et .ccp sont des classes ke jai utilisé ds un autre projets sans problemnes et je les rajouté au projet en cours. avc add files to folder.et lors de la compilation il compile les classes du premier projet car
c :\Documents and Settings\Soumaya\Bureau\compile\essay\Pile.cpp
est le chemin du pemier sujet.
jai rajouté dautre classes ke jai nommé Pile. h et .cpp et jai copier le contenu dedans et ca marche pas!!!!
0
Donc en fait le problème serait un problème de visibilité de fichiers.
Pile.cpp ne verrait-il pas le bon Pile.h ?
Le mieux, en général, n'est pas d'utiliser les fichiers d'un autre projet mais de les recopier dans le répertoire du projet en cours et de les ajouter au projet.
Toutefois il y a des redondances.

pile.cpp inclut les entêtes pile.h et noeud.h
pile.h inclut les entêtes pile.h et noeud.h
noeud.cpp inclut les entêtes pile.h et noeud.h
et que suppose pareil dans noeud.h

pile.cpp seulement pile.h
pile.h seulement noeud.h
noeud.cpp seulement noeud.h

Il est peut-être nécessaire d'ajouter d'autres includes.
0
samsouma04 Messages postés 60 Date d'inscription samedi 26 juillet 2008 Statut Membre Dernière intervention 17 mai 2009 1
6 janv. 2009 à 17:29
oui exactement ca il y a un probleme de visibilité le pile .cpp ne voit pas le .h
Ca se que jai fais jai declaré des nouveaux .h et .cpp et jai recopier dedans le contenu.ils sont propres au nouveau projet. aforce de ne pas trouver la solution jai inclue des include partout.mais je pense pas que cest la solution car je les enlevé comme tu m'as dis et ca avance pas.
0
Char Snipeur Messages postés 9696 Date d'inscription vendredi 23 avril 2004 Statut Contributeur Dernière intervention 3 octobre 2023 1 297
7 janv. 2009 à 09:39
J'ai rien compris à ton problème !
ça doit venir de VS. Un problème que tu n'aurait pas avec GCC.
Mais si tu as plusieurs fichiers du nom de Pile.h, le problème peux venir de là !!!
ou alors il faut mettre dans ces fichiers :
#ifndef _PILE_H_
#define _PILE_H_
...
#else
#include_next
#endif
0
samsouma04 Messages postés 60 Date d'inscription samedi 26 juillet 2008 Statut Membre Dernière intervention 17 mai 2009 1
13 janv. 2009 à 19:16
marci tt le monde jai enf1 reglé mon problemn en éliminant les .h et tt inclure dans le point cpp et ca a marché sans soucis.autre chose que je connais pas avnt que je dois préserver un certain ordre sequenciel. ca a marché. merci tt le monde.
0