Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7549681
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T10:00:31+00:00 2026-05-30T10:00:31+00:00

I think I have a cyclic dependency issue and have no idea how to

  • 0

I think I have a cyclic dependency issue and have no idea how to solve it….
To be as short as possible:
I am coding something like a html parser.
I have a main.cpp file and two header files Parser.h and Form.h.
These header files hold the whole definitions… (I’m too lazy to make the corresponding .cpp files…

Form.h looks like this:

//... standard includes like iostream....

#ifndef Form_h_included
#define Form_h_included

#include "Parser.h"
class Form {
public:
    void parse (stringstream& ss) {

        // FIXME: the following like throws compilation error: 'Parser' : is not a class or namespace name
        properties = Parser::parseTagAttributes(ss);

        string tag = Parser::getNextTag(ss);
        while (tag != "/form") {
            continue;
        }
        ss.ignore(); // >
    }
// ....
};
#endif

and Parser.h looks like this:

// STL includes
#ifndef Parser_h_included
#define Parser_h_included

#include "Form.h"

using namespace std;

class Parser {
public:
    void setHTML(string html) {
         ss << html;
    }
    vector<Form> parse() {
        vector<Form> forms;

        string tag = Parser::getNextTag(this->ss);
        while(tag != "") {
            while (tag != "form") {
                tag = Parser::getNextTag(this->ss);
            }
            Form f(this->ss);
            forms.push_back(f);
        }
    }
// ...
};
#endif

Don’t know if it is important, but I’m doing the build in MS Visual Studio Ultimate 2010
and it throws me
‘Parser’ : is not a class or namespace name

How to solve this problem?
Thank you!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-30T10:00:32+00:00Added an answer on May 30, 2026 at 10:00 am

    What you probably want to do here is leave the method declaration in the header like so

    class Form {
    public:
        void parse (stringstream& ss);
    // ....
    };
    

    And define the method in a source file (i.e. a Form.cpp file) like so

    #include "Form.h"
    #include "Parser.h"
    
    void parse (stringstream& ss) {
    
        properties = Parser::parseTagAttributes(ss);
    
        string tag = Parser::getNextTag(ss);
        while (tag != "/form") {
            continue;
        }
        ss.ignore(); // >
    }
    

    That should resolve the cyclic dependency issue you’re seeing…

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I think I have a basic understanding of REST, but something I'm stuck on
I think I have this working but I need advice. I'd like to know
I think I have a great idea for an iOS development tool, but I
I think I have the same issue as here , but can't quite get
I think I have a solution to this, but is there a better way,
I think I have a synchronization problem...It may be too basic..Please help.. I have
I think I have a problem in understanding the proper way of using MVC.
I think I have a conceptual misunderstanding and would appreciate an explanation. Within a
I think i have a basic problem in understanding the dojo toolkit. Well I
I think I have a pretty simple goal but cant seem to reach it.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.