Click here to Skip to main content
15,396,239 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Below is the code snippet which match with the real scenario of the problem:
circular dependency flow:
constants.hpp -> definition.hpp-> Entity.hpp -> output.hpp -> [...many more headers are included in the midde.....]-> constant.hpp

Below file name is Filter.hpp

C++
#include "src/constants.hpp"

namespace QW
{
namespace Interface
{

class Filter
{

Filter();

void getproperties(GG:Intercace:: filterConstants); // filterConstants values are coming from included header files.

void setproperties(GG:Intercace:: filterConstants);// filterConstants values are coming from included header files.

};
}
}


Note:constants.hpp is dependent on filter.hpp indirectly

below file name is output.hpp

C++
namespace QW
{
namespace Interface
{

class Output : public QW::Interface::Getoutput
{

QW::Interface::Filter filter;  
   // creating the object of Filter class and not allowed to create object dynamically.

};
}
}


observed Errors:
'Filter' is not the member of Qw:: Interface<br />
'Filter' unknown override specifier <br />
missing type specifier - int assumed.


Please suggest how can i resolve this circular dependency issue.

What I have tried:

i tried to use forward declaration but i did not work as it pointed that i need to create the pointer to the class not the object.
Posted
Updated 20-Mar-21 23:55pm
v5
Comments
Richard MacCutchan 21-Mar-21 6:01am
   
"how can i resolve this circular dependency issue"
Provide more information. It is difficult to see what the problem could be, and it appearst that you are not providing all the information. Please use copy and paster from the actual files that you are using, and the code where the error(s) occur, and the actual error messages, including the file and line numbers.

1 solution

'Filter' is not the member of Qw:: interface

There is a difference between Interface with an upper case I and interface with a lower case i.
missing type specifier - int assumed.

You have not declared the return type on the two methods getproperties and setproperties.

Beyond that it is difficult to suggest anything with so little information provided.
   
Comments
Maciej Los 21-Mar-21 5:56am
   
5ed!

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900