Sign in to follow this  
ShmeeBegek

Another problem with mingw

Recommended Posts

I have another problem now..
cStringTree *getNode(list<Character*>strings,int nless=0)
	{
		// Traverse down the tree
		cStringTree<Character,Type> *cnode = this;
		int l = strings.size();
		list<Character*>::iterator it;


On the last line there where I declare the iterator I get: error: expected ';' before "it" Just out of interest I changed Character to char and it worked perfectly... but there shouldn't be a reason for Character causing compilation errors:
template <class Character,class Type>


Any ideas on this one? Thanks, ~SPH

Share this post


Link to post
Share on other sites
Quote:
Original post by ShmeeBegek

Thanks, I have another problem now..
*** Source Snippet Removed ***

On the last line there where I declare the iterator I get:
error: expected ';' before "it"

Just out of interest I changed Character to char and it worked perfectly... but there shouldn't be a reason for Character causing compilation errors:

*** Source Snippet Removed ***

Any ideas on this one? Thanks, ~SPH



cStringTree *getNode(list<Character*>strings,int nless=0)
{
// Traverse down the tree
cStringTree<Character,Type> *cnode = this;
int l = strings.size();
typename list<Character*>::iterator it;



Because Character is a template argument, the compiler doesn't know what list<Character*>::iterator is - it could be a nested type or a static data memeber. Thus, you need to tell the compiler what it's dealing with, which is what the typename keyword does.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this