Sign in to follow this  

Another problem with mingw

This topic is 4560 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

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

This topic is 4560 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

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