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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T04:40:09+00:00 2026-05-31T04:40:09+00:00

For my CS Data Structures class, I am implementing a Generic Stack using linked

  • 0

For my CS Data Structures class, I am implementing a Generic Stack using linked list. However, I am getting “Redefinition of …. ” errors for all my constructors and functions in my .cpp file. The header file, “Stach.h”, was given by the instructor, and at the end she included “Stack.cpp”. Everything works fine when I comment out that line, but she wants it there.
Anybody ever heard of this?

Thanks guys,

David

  • 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-31T04:40:11+00:00Added an answer on May 31, 2026 at 4:40 am

    The only time that I have included a .cpp file is when I wanted to put the implementation of a template in a .cpp file so that my editor recognized it as C++ instead of C. Is the implementation of the stack a template?

    If it is, then the implementation of the template methods have to be available to compilation units that are using them. You usually use .ipp or .tcc for template implementation files if you are going to implement somewhere other than in the header itself. This is what Boost and a number of other libraries do. If this is the case, then you should not be compiling stack.cpp since the compiler will take care of that when your client or driver program includes the header file.

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

Sidebar

Related Questions

I took a data structures class in C++ last year, and consequently implemented all
For my Algorithms & Data Structures class, I've been tasked with implementing a splay
My data structures class is working with trees. We are implementing a 3-ary tree,
I am currently still in school and taking a class on implementing data structures
I'm trying different data structures for implementing Prim's algorithm. So I made a class
In the data structures class that I am currently taking, we have been tasked
I have a project for my Data Structures class, which is a file compressor
I'm doing an assignment for my Data Structures class. we were asked to to
Let's say I have data structures that're something like this: Public Class AttendenceRecord Public
I want to implement in Java a class for handling graph data structures. I

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.