compile error when using two typename in template class I am using Arduino 1.8.5 ide. I am just creating a class with two typename which name is "Map". This class takes all int and String variations. Like;

class Map&lt;int, int&gt;;
class Map&lt;int, String&gt;;
class Map&lt;String, int&gt;;
class Map&lt;String, String&gt;;


Map&lt;int, String&gt; *list = new Map&lt;int, String&gt;();


If I create instance of this class like above in Main.ino file then everything is ok. But if I create it another file with .h extension which is "Test.h" then compilation fails. These are files;

    Main.ino

#include "Map.h"
#include "Test.h"

Test *test = new Test();
Map&lt;int, String&gt; *list = new Map&lt;int, String&gt;();


void setup() {

}

void loop() {

}


Map.cpp

#include "Arduino.h"
#include "Map.h"

template&lt;typename E, typename T&gt; Map&lt;E, T&gt;::Map()
{

}


template class Map&lt;int, int&gt;;
template class Map&lt;int, String&gt;;
template class Map&lt;String, int&gt;;
template class Map&lt;String, String&gt;;


Map.h

#ifndef Map_h
#define Map_h

#include "Arduino.h"

template&lt;typename E, typename T&gt; class Map {

public:
    Map();
    ~Map();
};

#endif


Test.h

#ifndef _Test_h
#define _Test_h


#include "Arduino.h"
#include "Map.h"

class Test
{
public :
    Test();
    ~Test();
    Map&lt;int, String&gt; *list = new Map&lt;int, String&gt;();
};

#endif


Error is;

In file included from C:\Users\zafer\Desktop\Main\Main.ino:3:0:
Test.h:14: error: expected ';' at end of member declaration
  Map&lt;int, String&gt; *list = new Map&lt;int, String&gt;();

                                        ^

Test.h:14: error: expected unqualified-id before '&gt;' token
  Map&lt;int, String&gt; *list = new Map&lt;int, String&gt;();

                                              ^

Test.h:14: error: wrong number of template arguments (1, should be 2)
  Map&lt;int, String&gt; *list = new Map&lt;int, String&gt;();

                                   ^

In file included from C:\Users\zafer\Desktop\Main\Main.ino:2:0:
Map.h:6: error: provided for 'template&lt;class E, class T&gt; class Map'
 template&lt;typename E, typename T&gt; class Map {

                                        ^
exit status 1
expected ';' at end of member declaration


Sorry, If it's been already resolved and I couldn't find it.

Thank you.
In this class declaration:

class Test
{
public :
    Test();
    ~Test();
    Map&lt;int, String&gt; *list = new Map&lt;int, String&gt;();
};


This line is wrong:

    Map&lt;int, String&gt; *list = new Map&lt;int, String&gt;();


You can't execute procedural code when declaring a class. That has to go into the constructor or some other function.

For example, this compiles without errors:

Test.h

#ifndef _Test_h
#define _Test_h


#include "Arduino.h"
#include "Map.h"

class Test
{
public :
    Test() { list = new Map&lt;int, String&gt;; } ;
    ~Test();
    Map&lt;int, String&gt; *list;
};

#endif