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 7414339
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T07:05:07+00:00 2026-05-29T07:05:07+00:00

I have 2 files that are both including the other file and I am

  • 0

I have 2 files that are both including the other file and I am getting strange errors.

#ifndef NODE_H
#define NODE_H

#include "model.h"
etc....
#endif

#ifndef MODEL_H
#define MODEL_H

#include "Node.h"
etc....
#endif

Here is my example code of what I am doing. Can somebody explain to me why this is not possible or allowed? And what I should do to get passed this problem.

  • 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-29T07:05:08+00:00Added an answer on May 29, 2026 at 7:05 am

    You have a circular dependency between Node and model.

    To deal with this, instead of…

    #include "Node.h"
    

    …in model.h , forward declare…

    class Node;
    

    …and this will allow you to have Node& node; in your Model class.

    Or vice-versa.

    Better still… see if you can revisit your design and eliminate this circular dependency.

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

Sidebar

Related Questions

Let's assume that I have files a.cpp b.cpp and file c.h. Both of the
I have a task to import/transform and extract zipped binary files that contain both
I have a program that works with a variety of files on both the
I have two string variables which are both file paths. The code that worked
I have two xsd files. 1st file is common.xsd and the other is node.xsd
I have some files that need to be sorted by name, unfortunately I can't
I have some files that I would like to rename using regex and powershell,
I have some files that are uuencoded, and I need to decode them, using
I have some files that I'd like to delete the last newline if it
I have some files that need to use by my application when it is

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.