Look follow code:
The Main.h
#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
#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
#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?
Please read the rules for this site!
http://forums.next.codeblocks.org/index.php/topic,9996.0.html (http://forums.next.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.
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
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
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.