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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T19:52:53+00:00 2026-05-25T19:52:53+00:00

I have a .h file with this in it: #ifndef CS240_LINKED_LIST_H #define CS240_LINKED_LIST_H #include

  • 0

I have a .h file with this in it:

#ifndef CS240_LINKED_LIST_H
#define CS240_LINKED_LIST_H

#include <string>

//! LLNode implements a doubly-linked list node
class LLNode {
        friend class LinkedList;
    public:
    
        LLNode(const std::string & v, LLNode * p, LLNode * n) :
          value(v), prev(p), next(n)
        {
        }
    
    private:
        std::string value;        //!< value stored in the node
        LLNode * prev;            //!< pointer to previous node in the list
        LLNode * next;            //!< pointer to next node in the list
};


//! LinkedList implements a doubly-linked list
class LinkedList
{
    public:
    
        //!  No-arg constructor.  Initializes an empty linked list
        LinkedList();
    
    
        //!  Copy constructor.  Makes a complete copy of its argument
        LinkedList(const LinkedList & other);
    
    private:
        //!  two dummy nodes to keep track of the beginning and end of the list.
        LLnode beginning;
        LLnode end;
        int size;
};

#endif

In a cpp file I have:

#include "LinkedList.h"

LinkedList::LinkedList(){
    this->beginning.prev = NULL;
    this->beginning.next = this->end;
    this->end.prev = this->beginning;
    this->end.next = NULL;
}

Here’s the output:

>g++ -o LinkedList.o LinkedList.cpp
In file included from LinkedList.cpp:1:
LinkedList.h:37: error: 'LLnode' does not name a type
LinkedList.h:38: error: 'LLnode' does not name a type
LinkedList.cpp: In constructor 'LinkedList::LinkedList()':
LinkedList.cpp:4: error: 'class LinkedList' has no member named 'beginning'
LinkedList.cpp:5: error: 'class LinkedList' has no member named 'beginning'
LinkedList.cpp:5: error: 'class LinkedList' has no member named 'end'
LinkedList.cpp:6: error: 'class LinkedList' has no member named 'end'
LinkedList.cpp:6: error: 'class LinkedList' has no member named 'beginning'
LinkedList.cpp:7: error: 'class LinkedList' has no member named 'end'

I don’t know how to fix this. How else would I set the beginning and end objects? Just so you know, I’m a Java programmer learning C++.

  • 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-25T19:52:54+00:00Added an answer on May 25, 2026 at 7:52 pm
    • You have misspelt LLNode as LLnode.
    • You need to add a default constructor to the LLNode class
    • you need to take the address of the this->beginning and this->end members in the LinkedList constructor:

    .

    LinkedList::LinkedList(){
        this->beginning.prev = NULL;
        this->beginning.next = &this->end;
        this->end.prev = &this->beginning;
        this->end.next = NULL;
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have this file logger.hpp: #ifndef _LOGGER_HPP_ #define _LOGGER_HPP_ #include event.hpp // Class definitions
I have a C++ file like this #ifndef _MOVE_H #define _MOVE_H class Move {
When I have a header file like this: #ifndef GAMEVIEW_H_ #define GAMEVIEW_H_ #include <SDL/SDL.h>
I have this include file ( memory .h ) #ifndef MEMORY_H #define MEMORY_H #ifdef
I have a header file like this: #ifndef __GEN_NOTE_MARKERS_TO_DEVELOPERS_HPP__ #define __GEN_NOTE_MARKERS_TO_DEVELOPERS_HPP__ #ifdef _DEBUG //
I have a file GetL.hxx #ifndef GetL_included #define GetL_included #include <iostream> using namespace std;
I have a C header file like this: #ifndef RENDERER_H #define RENDERER_H static int
I have the following header file: #ifndef DATABASE_H #define DATABASE_H #include <vector> #include <iostream>
I have a file in .gz format. The java class for reading this file
Well, I have a header (my_prog.h) which looks like this: #ifndef __MY_HEADER_H #define __MY_HEADER_H

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.