user3272549
user3272549

Reputation: 1

expected template name before '<' token

I am a newbie to C++. Trying to port a Windows-based program to linux. The platform I use is Ubuntu 13.03. The compiler is g++.

Here is the problematic code.

class CMapIDNames : public map< IDKey, string, CIDKeyLess >
{
} mapOfIDNames;

The errors are:

error: expected template-name before ‘<’ token

Tried to include <functiontal>, and namespace::std, does not help.

Upvotes: 0

Views: 5619

Answers (1)

juanchopanza
juanchopanza

Reputation: 227418

You need to include <map> and refer to is as std::map. You also seem to be missing the <string> header.

#include <map>
#include <string>

class CMapIDNames : public std::map< IDKey, std::string, CIDKeyLess >
{
};

But note that standard library containers are not designed for public inheritance. You should certainly not use them polymorphically.

Upvotes: 5

Related Questions