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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T17:21:31+00:00 2026-06-08T17:21:31+00:00

I have two simple classes, very simple One is like master table and contains

  • 0

I have two simple classes, very simple One is like master table and contains list of pointers to class Two, and class Two contains one pointer to class One. In every class there is function which call methods over pointers, but I am getting error like
error C2027: use of undefined type

---- class One.h"
#include "Two.h"

class One {
public:
list<Two*> something;
void t(){pointer on Two call methods}
};

and

---------class Two.h 
 class One;
class Two {
public:
One* something;
void t(){pointer on One call methods}
};

How to solve 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-06-08T17:21:32+00:00Added an answer on June 8, 2026 at 5:21 pm

    Move your method defenition to .cpp and include the required header with the type defenition.

    Two.h
    class One;
    class Two {
    public:
        One* something;
        void t();
    };
    
    Two.cpp:
    void Two::t() {...}
    

    This is required because compiler is not able to generate the code for calling a method of an undefined type

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

Sidebar

Related Questions

I have two very simple classes, one extends the other: public class LocationType implements
I have two very simple classes Submission and Store class Submission(models.Model): title = models.CharField(max_length=50,
I have a simple Fluent NHibernate model with two related classes: public class Applicant
I have a very simple object model with a base class Person and two
In a simplified situation like this one, with 3 classes: class ClassONE{ protected List<IntermediatedClass>;
I have two classes. One class works does the calculations, whilst the other is
I have two very simple routes routes.MapRoute( post, // Route name postPage + /{slug},
I have two relatively simple codes. One main activity and one intent service. Main
I have two very simple, identical UITableViews in my app that are populated with
I have these two simple files that define a C++ class with a tryME

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.