PDA

View Full Version : need help please



imed007
14th April 2016, 11:43
Hello guys i have a problem with my project while compiling it
Please help me
this is the url of my project
https://drive.google.com/file/d/0B0AjrlM3oBSXYlhFdlhOSmhOQzg/view?usp=docslist_api11894
and the pic above show the prob



it said that "bacterie" (class) hasn't been declared , but its declared !!!!!!!!!!!!!!!!!!!

anda_skoa
14th April 2016, 13:10
What is the problem?

Cheers,
_

imed007
14th April 2016, 15:39
What is the problem?

Cheers,
_

sorry for less informations

anda_skoa
14th April 2016, 16:28
can you post bacterie.h?

Cheers,
_

imed007
14th April 2016, 16:33
#ifndef BACTERIE_H
#define BACTERIE_H
#include "dialog.h"

class bacterie : public QObject
{ Q_OBJECT
public:

bacterie();

bacterie * set_svt_bacterie();

int get_j_bacterie ();

int get_i_bacterie ();

int get_ue_bacterie ();

void Reservebacterie(int &num);



void verrifeirbacterie(bacterie * &b);

void delete_bacterie (bacterie *&p );

//private :

int m_num;
int m_UE;
int m_i;
int m_j;
bacterie * m_prec;
bacterie * m_svt;
QLabel * m_label;

};
void affectbacterie(bacterie *&b,int &n,QLabel * p);
#endif BACTERIE_H

anda_skoa
14th April 2016, 17:35
Looks quite ok, but why do you include "dialog.h"?

Cheers,
_

d_stranz
14th April 2016, 21:49
You have at least two circular dependencies in your #include files:

dialog.h includes bacterie.h, which includes dialog.h
dialog.h includes bug.h, which includes dialog.h

Remove #include "dialog.h" from bug.h and bacterie.h and it should compile without problems.

imed007
15th April 2016, 06:40
Thank you guys for helping me

d_stranz
15th April 2016, 15:37
You should read in your C++ books about "forward declarations". If you use them correctly, you will be able to avoid these kind of problems and will not need to have include files everywhere in your code, but only where they are actually needed.