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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T01:37:43+00:00 2026-05-13T01:37:43+00:00

I get error C2027: use of undefined type ‘Bridge’ and error C2227: left of

  • 0

I get
error C2027: use of undefined type ‘Bridge’

and

error C2227: left of ‘->receive’ must point to class/struct/union/generic type

on line *connection1->receive(newMessage,2);

#include <stdio.h>
#include <stdlib.h>
#include <iostream>
#define MAXHOST 10
#define MAXPORT 5
#define MAXLAN 8
#define MAXBRIDGE 5
#define MAXLANBRIDGECON 2

using namespace std;
class Bridge;
class Host;
class Message;
class Simulation;
class Lan;


class Message{
//////////////

};


class Host{
    Lan * lan1;
    int id;

    int nextMessageTime;
public:
    /////////
};

class Lan{

    Bridge *connection1, *connection2;
    int bridgeConnection;
    Host hostList[MAXHOST];
    int id;
    int hostCount;
public:
    void connect(Bridge  * const newBridge)
    {
        if(bridgeConnection==0)
        {
            connection1 = newBridge;


        }
        if(bridgeConnection==1)
        {
            connection2 = newBridge;

        }
        bridgeConnection++;
    }
    void receive(Message newMessage){

        *connection1->receive(newMessage,2);


    }


};

class Bridge{
/////////////////////
};
void main(){
    Simulation newSim;
    newSim.create();

return;
}
  • 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-13T01:37:44+00:00Added an answer on May 13, 2026 at 1:37 am

    All the posts before are right, forward declaring is used to prevent circular includes in header files. The Bridge class is forward declared, so that you can specify pointers of that type within your class definition of LAN. Since pointers all have the same size this is ok.

    When it comes to using this class the compiler has to know more about the Bridge class, at least its size. But there is no information other than that there is a class named Bridge.

    The solution would be either to include the header where Bridge is defined (delete the class Bridge definition if you do this), or to move the implementation of LAN::connect() and LAN::receive() in its own implementation file LAN.cpp and include the Bridge header there which is probably the clean solution.

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

Sidebar

Related Questions

during build with Visual Studio C++ I get this error: error C2027: use of
Why do I get Error The type 'string' must be a non-nullable value type
Why do I get error C2504: 'CEntity' : base class undefined errors, when all
I use the following jquery statements but i get error in this function onGetDataSuccess(result)
When including sqlite3.c into my project, I get lots of compiler errors: error C2027:
i get Error #1010 when i use this while loop: while (pos.length>0) { coo
Get error 'ClassLibrary3.Class1.a' is a 'property' but is used like a 'type' when i
I get some error working with alert dialog. I use 4.1 jelly bean sdk.
when is do this i get error: incompatible type for argument 1 of ‘display’
I Get Error when i use the following code str = Insert into BasicData

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.