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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T22:33:03+00:00 2026-05-26T22:33:03+00:00

I was trying to implement a Piece Table data structure using Linked Lists in

  • 0

I was trying to implement a Piece Table data structure using Linked Lists in a project of mine. My project has 7 files, as follows:

  • LinkedList.cpp

  • LinkedList.h

  • Node.cpp

  • Node.h

  • PieceTable.h

  • PieceTable.cpp

  • Main.cpp

So the problem here is that in my class PieceTable, I have a data member of type LinkedList. Everything was fine till yesterday. I had built the project multiple times and it was working good. Today, in the morning, I added 1 function to LinkedList and another to PieceTable. When I tried top build it, the compiler says:

1>c:\users\devjeet\documents\visual studio 2010\projects\piece table\piece table\piecetable.h(33): error C2079: 'PieceTable::dList' uses undefined class 'LinkedList'

dList is the name of the class member of type LinkedList. I even put a forward class declaration, upon which the compiler said something that meant :

LinkedList is an undefined class

Here are the header files :

PieceTable :

#ifndef PIECETABLE_H
#define PIECETABLE_H
#include <Windows.h>
#include <iostream>
#include "LinkedList.h"
#include "Node.h"

class LinkedList;

using namespace std;

class PieceTable
{
public:
    PieceTable(void);
    ~PieceTable(void);

    //buffer realated functions
    void setBuffer(char buffer[]);

    //printing functions
    void printBuffer();
    void printTable();


    //text insertion functions 
    void insertTextAfterPosition(char text, const int& position);
private:
    LinkedList dList;
    char* originalBuffer;
    char* editBuffer;
    int bufferLength;
    int editBufferCounter;

};
#endif

LinkedList :

#ifndef LINKEDLIST_H
#define LINKEDLIST_H
#include "Node.h"
#include "PieceTable.h"

class Node;

class LinkedList
{
public:
    LinkedList();
    ~LinkedList();

    bool isEmpty() const;

    //functions that deal with getting nodes
    Node* getNodeAtPosition(const int& position) const;
    Node* getFront() const;
    Node* getBack() const;
    Node* getHead()const;
    Node* getTail()const;
    Node* getNodeFromOffset(const int& offset) const;

    //functions that deal with adding nodes
    void append(const int offset, const int& length,const bool descriptor);
    void add(Node* node, const int offset, const int& length,const bool descroptor);                                //adds a node after the given node
    void insertNodeAfterPosition(const int offset, const int& length,const bool descriptor, const int& position);

    //function concerned with deletion
    void removeNode(Node* node);
    void deleteNodeAtPosition(const int& position);
    void removeBack();
    void removeFront();
    void emptyList();

    //debugging functions
    void printNodes();
private:
    Node* head;
    Node* tail;
};

#endif

Note that the problem occurs whether I use #pragma once or #ifndef/#endif

Thanks,

Devjeet

  • 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-26T22:33:04+00:00Added an answer on May 26, 2026 at 10:33 pm

    This is a fairly straight-forward circular inclusion: piecetable.h includes linkedlist.h, and linkedlist.h erroneously includes piecetable.h. I believe you can remove the second inclusion, and you can remove the forward declaration of class LinkedList from piecetable.h.

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

Sidebar

Related Questions

trying to implement a dialog-box style behaviour using a separate div section with all
I'm trying to implement a Search-Function using c++ and libpqxx. But I've got the
I was trying to implement the Sorry! board game using C++ such that 4
I am trying to implement an ihttphandeler for streaming files. files may be tiny
I am trying to work out how to implement a new piece of functionality
I'm trying to implement a piece of code to synchronously start looped service in
I'm trying to implement a piece of functionality that will let the user to
I am trying to implement a 'git-flow' kind of workflow using Gerrit but I
I'm trying to implement a time limit a user has to answer a question
I am trying to implement the Strategy design pattern using interfaces. However, while developing

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.