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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T19:33:10+00:00 2026-05-28T19:33:10+00:00

I am creating a DLL using the code provided to us by my instructor.

  • 0

I am creating a DLL using the code provided to us by my instructor. However I have tried to compile it at home and it does not seem to work. Any help would be appreciated.

template<class T>
class mySTLlist : public list<T> {
public:
    void addInMiddle(T t){}

    friend ostream& operator<<(ostream& out,  mySTLlist<T>& lst) {
        for(mySTLlist<T>::iterator i = lst.begin(); i != lst.end(); i++)
            out << *i << ' ';
        out << '\n';
        return out;
};

It gives me an Error at:

mySTLlist<T>::iterator i = lst.begin(); 

It says that i need a ; before it and it is not declared.
I am relatively new to 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-28T19:33:11+00:00Added an answer on May 28, 2026 at 7:33 pm

    This is a good illustration of why it is important to include a complete example, and also to read all of the error messages. Your code is missing some include headers; at minimum, it needs the following at the top:

    #include<list>
    #include<iostream>
    using namespace std;
    

    When I correct those and add the missing } at the end, and compile it, I get three errors:

    foo.cpp:14:9: error: need 'typename' before 'mySTLlist<T>::iterator' because
    'mySTLlist<T>' is a dependent scope
    foo.cpp:14:32: error: expected ';' before 'i'
    foo.cpp:14:49: error: 'i' was not declared in this scope
    

    The first one says that we need to add “typename” (note that this is in quotes, meaning the literal keyword typename, not the name of a type), so we add exactly what it says we need, changing that line to:

    for(typename mySTLlist<T>::iterator i = lst.begin(); i != lst.end(); i++)
    

    That fixes the problem. The error that you are seeing is a follow-on error — because the declaration of i was buggy, it skipped over it to see what it could do with the rest of the file. The next time you use i, it complains that it hasn’t been declared (which is, of course, because it skipped the declaration) — and, likewise, the missing ; error is because of how it’s skipping past that first error. So, fix the first problem, and that fixes the rest.

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

Sidebar

Related Questions

I have some C# code which is using CSharpCodeProvider.CompileAssemblyFromSource to create an assembly in
I am using Excel 2007. I have C# code written in a separate binary.
I have created a C++/CLI mixed DLL which I am using from C# Winforms
If a customer does not allow installation of a .dll into their SharePoint 2007
So i work in clr, creating .net dll in visual c++. I tru such
I have A.DLL that depends on B.DLL. A.DLL contains some initialization code ( DllMain
Beyond creating a dll with all the same functions with the same interface and
What are first steps creating a loadable DLL module extension for PHP to create
I'm creating a C api that hides some functionality in a DLL file. Since
We are creating a WCF service with a companion client DLL (.Net) that we

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.