Author Topic: [help] About the head error: expected class-name before '{' token  (Read 4184 times)

Offline lfjking

  • Multiple posting newcomer
  • *
  • Posts: 17
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?
« Last Edit: December 01, 2016, 05:01:12 pm by lfjking »

Offline stahta01

  • Lives here!
  • ****
  • Posts: 7588
    • My Best Post
Re: [help] About the head error: expected class-name before '{' token
« Reply #1 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

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

Tim S.
C Programmer working to learn more about C++ and Git.
On Windows 7 64 bit and Windows 10 64 bit.
--
When in doubt, read the CB WiKi FAQ. http://wiki.codeblocks.org

Offline lfjking

  • Multiple posting newcomer
  • *
  • Posts: 17
Re: [help] About the head error: expected class-name before '{' token
« Reply #2 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

Offline Jenna

  • Administrator
  • Lives here!
  • *****
  • Posts: 7255
Re: [help] About the head error: expected class-name before '{' token
« Reply #3 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.