User forums > Help

[help] About the head error: expected class-name before '{' token

(1/1)

lfjking:
Look follow code:

The Main.h

--- Code: ---
#ifndef MAIN_H
#define MAIN_H

#include "Thread.h"

class Thread;
class Main
{
public:
/** Default constructor */
Main(wxApp* parent);
/** Default destructor */
virtual ~Main();
private:
               Thread*  mthread;
};

#endif // MAIN_H


--- End code ---

--------------------------------------------------------------------------------------------
The thread.h

--- Code: ---
#ifndef THREAD_H
#define THREAD_H

#include "Main.h"

class Main;
class Thread
{
public:
/** Default constructor */
Thread(Main* parent);
/** Default destructor */
virtual ~Main();
private:
               Main* mMain;
};

#endif // THREAD_H


--- End code ---

===================================the error in the  follow===============================
the threadchild.h

--- Code: ---
#ifndef THREADCHILD_H
#define THREADCHILD_H

#include "Thread.h"

class Threadchild: public Thread
{//---------------------------------------------------error: expected class-name before '{' token----------------------------------------------
public:
/** Default constructor */
Thread(Main* parent);
/** Default destructor */
virtual ~Main();
private:
               Main* mMain;
};

#endif // THREADCHILD_H


--- End code ---


How to solve this problem???

Similar to this mutual call,What are taboo?

stahta01:
Please read the rules for this site!
http://forums.codeblocks.org/index.php/topic,9996.0.html

I see no real question in your post; I suggest asking one if it does NOT violate the rules!

Tim S.

lfjking:
the Question is:
When the AB class is a class of mutual include(like as class Main and Thread)
the third class C if include one of AB class, it will error: expected class-name before '{' token,on the third class head, like as the eg. class: threadchild

Jenna:

--- Quote from: lfjking on December 02, 2016, 01:13:28 pm ---the Question is:
When the AB class is a class of mutual include(like as class Main and Thread)
the third class C if include one of AB class, it will error: expected class-name before '{' token,on the third class head, like as the eg. class: threadchild

--- End quote ---
This shows, that you did not (re-)read the rules.

General programming questions arenot allowed on this site/forum.
Just Code::Blocks (an IDE) related questions.

Topic locked, because it violates our forum rules. Sorry.

Navigation

[0] Message Index

Go to full version