Impossible expected class name before '{token error to resolve

This is a well-known issue with this damn mistake.

expected class name to '{token

Well, despite my hard work and googling, I could not solve this error. I'm sorry. This is my last beach.

In ui.cpp of my project, I do:

#include "wfqueue_proxy_factory.hpp"

OK, this causes this stupid error in my compiler:

In the file included in wfqueue_proxy_factory.hpp: 29, from ui.cpp: 28: wfqueue_manager_proxy.hpp: 42: error: expected class name before '{token

There are three classes in my project: First

// wfqueue_proxy_factory.hpp
#ifndef _WFQUEUE_PROXY_FACTORY_HPP
#define _WFQUEUE_PROXY_FACTORY_HPP
#include "wfqueue_manager_proxy.hpp"
// ...
class WFQueueProxyFactory {
//...
};
#endif

Second

// wfqueue_manager_proxy.hpp
#ifndef _WFQUEUE_MANAGER_PROXY_HPP
#define _WFQUEUE_MANAGER_PROXY_HPP
#include "workflow.hpp"
#include "wfqueue.hpp"
// ...
class WFQueueManagerProxy : public WFQueue { // This is the problem (line 42)
//...
};
#endif

Third

// wfqueue.hpp
#ifndef _WFQUEUE_HPP
#define _WFQUEUE_HPP
#include "workflow.hpp"
class WFQueue {
// ...
};
#endif

, , , , ; } , EVERY , , , ; . workflow.hpp, ( - , ).

WFQueue - - , , . WFQueue ... .... , , "interface" , .

, :

// wfqueue_manager_proxy.hpp
#ifndef _WFQUEUE_MANAGER_PROXY_HPP
#define _WFQUEUE_MANAGER_PROXY_HPP
#include "workflow.hpp"
#include "wfqueue.hpp"
// ...
class WFQueueManagerProxy {
//...
};
#endif

, ... , .

+3
5

: ,

class WFQueueManagerProxy : public WFQueue { // This is the problem (line 42)
//...
};

{. , , WFQueue . , ? , , wfqueue.hpp WFQueue - ?

+3

, , . , , -o outfile - -E (. , ).

( stdout) #includes , , ( , , , ). , , . , .

+4

. , . , , WFQueue WFQueueManagerProxy.

+1

, ... ... , . , 2 , , - ... , . , ols g++ , ... ... . Icecrime ... , , , , , . . , . .

+1
source

Make sure you type

using namespace omnetpp;

after includes. He solved my problem.

0
source

Source: https://habr.com/ru/post/1777292/


All Articles