0

I have a tiny snippet of code that seems absolutely fine:

#include <iostream> //Access standard IO library
#include <string>   //Access type 'string'
#include <list>     //Access type 'list'

using namespace std; //Use standard library namespace

int main ()
{
    list<string> strungos {"No", "Yes"};
    cout << strungos.back();
    return 0;
}

but every time I try to compile I get the error: expected primary-expression before "strungos", expected ';' before "strungos". I don't know why this is happening; the same code runs perfectly fine when I paste it into an online compiler. After testing this again with different types, it seems like I can't use std::list at all.

What am I doing wrong?

R. Burton
  • 111
  • 6

0 Answers0