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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T23:20:39+00:00 2026-06-13T23:20:39+00:00

My project is to write a program in C++ that creates a user-defined, list-implemented

  • 0

My project is to write a program in C++ that creates a user-defined, list-implemented stack and queue that checks for letter-by-letter palindromes and word-by-word palindromes. So I would need to have a stack and queue that checks for char and string types. Since it’s a project for intermediate programming (third course in my C++ sequence), we can’t use the STL list/queue/stack objects, and we haven’t learned templates yet. But I figure it’s annoying to have to write a different implementation for string or char input and want to use templates.

I got the program to run just fine when all the code is under a single file – the classes and their implementations are all in my main.cpp. But I split the code up, putting the class definitions in a list.h and the implementation in a list.cpp, and kept the driver code in main.cpp.

Now when I run, I get these errors:

Error   1   error LNK2019: unresolved external symbol "public: void __thiscall  Stack<int>::push_front(int)" (?push_front@?$Stack@H@@QAEXH@Z) referenced in function _main  
Error   3   error LNK2019: unresolved external symbol "public: void __thiscall Queue<char>::push_back(char)" (?push_back@?$Queue@D@@QAEXD@Z) referenced in function _main   d:\my documents\visual studio 2012\Projects\DACUNTO_HW5P2_TEMP\DACUNTO_HW5P2_TEMP\main.obj  DACUNTO_HW5P2_TEMP
Error   2   error LNK2019: unresolved external symbol "public: int __thiscall Stack<int>::pop_front(void)" (?pop_front@?$Stack@H@@QAEHXZ) referenced in function _main  d:\my documents\visual studio 2012\Projects\DACUNTO_HW5P2_TEMP\DACUNTO_HW5P2_TEMP\main.obj  DACUNTO_HW5P2_TEMP
Error   4   error LNK2019: unresolved external symbol "public: char __thiscall Queue<char>::pop_back(void)" (?pop_back@?$Queue@D@@QAEDXZ) referenced in function _main  d:\my documents\visual studio 2012\Projects\DACUNTO_HW5P2_TEMP\DACUNTO_HW5P2_TEMP\main.obj  DACUNTO_HW5P2_TEMP
Error   5   error LNK1120: 4 unresolved externals   d:\my documents\visual studio 2012\Projects\DACUNTO_HW5P2_TEMP\Debug\DACUNTO_HW5P2_TEMP.exe 1   1   DACUNTO_HW5P2_TEMP

I don’t know why this happens, but the program runs fine when it’s all under one file. Here’s my code:

main.cpp: http://pastebin.com/mQW4EV99

list.h: http://pastebin.com/Lze6jZv2

list.cpp: http://pastebin.com/7bks6Bt1

Thank you

  • 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-13T23:20:40+00:00Added an answer on June 13, 2026 at 11:20 pm

    The compiler wants the templates’ definitions visible where used.

    Either:

    • Move the definitions to the class declaration (e.g. similar to your constructor for List)
    • or #include the .cpp (and change its extension for your sanity)

    When you hear templates can increase compile times, this is the primary reason why.

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

Sidebar

Related Questions

I need to write a program (a project for university) that solves (approx) an
I have an MVC project that I would like to write in .NET 4.0
I'm writing a hobby project wherein I write to .wav files. I decided that
My objective is to write a program that can create folders and within those
I am trying to write a program that supports speech recognition via a custom
I can understand how one can write a program that uses multiple processes or
I am trying to write a program that uses a C API. This API
I am trying to write a list to a text file that is included
I'm developing a little program that creates virtual joysticks on linux, with a python
So I wrote a project-management program for a small business using Microsoft Access 2007.

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.