News:

As usual while waiting for the next release - don't forget to check the nightly builds in the forum.

Main Menu

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

Started by lfjking, December 01, 2016, 04:58:20 PM

Previous topic - Next topic

lfjking

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?

stahta01

Please read the rules for this site!
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.
C Programmer working to learn more about C++.
On Windows 10 64 bit and Windows 11 64 bit.
--
When in doubt, read the CB WiKi FAQ. [url="http://wiki.codeblocks.org"]http://wiki.codeblocks.org[/url]

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