Code::Blocks Forums

User forums => Help => Topic started by: lfjking on December 01, 2016, 04:58:20 pm

Title: [help] About the head error: expected class-name before '{' token
Post by: lfjking on December 01, 2016, 04:58:20 pm
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


--------------------------------------------------------------------------------------------
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


===================================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



How to solve this problem???

Similar to this mutual call,What are taboo?
Title: Re: [help] About the head error: expected class-name before '{' token
Post by: stahta01 on December 01, 2016, 05:36:20 pm
Please read the rules for this site!
http://forums.codeblocks.org/index.php/topic,9996.0.html (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.
Title: Re: [help] About the head error: expected class-name before '{' token
Post by: 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
Title: Re: [help] About the head error: expected class-name before '{' token
Post by: Jenna on December 02, 2016, 01:26:32 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
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.