0

error C4430: missing type specifier - int assumed. Note: C++ does not support default-int

I have 638 of these errors so I know it is all caused by one single error. This code I am using worked perfectly using VS6 and VS7 and GCC. Migrating it to VS2013 made a few errors here and there. I have no idea why it is giving me this error. I will post a block of the code where it is occurring. If you need more explanation of a certain something please just let me know. I tried looking all over the internet, but it looks like this C4430 occurs for various reasons.

The first error of many begins on line 8

// ----------------------------------------------------------------------------
//  vector-based database for fast O(1) lookups.
// ----------------------------------------------------------------------------
template< typename entity >
class VectorDatabase : public Database< entity, std::vector<entity> >
{
public:
    typedef std::vector<entity> container; //This is the first of many where the error is occuring
    typedef container::iterator iterator;

    bool isvalid( entityid p_id )
    {
        return p_id < m_container.size() && p_id != 0;
    }

    entity& get( entityid p_id )
    {
        if( p_id >= m_container.size() || p_id == 0 )
            throw Exception( "Out of bounds error in vector database" );

        if( m_container[p_id].ID() == 0 )
            throw Exception( "Invalid Item in vector database" );

        return m_container[p_id];
    }

    entity& create( entityid p_id )
    {
        if( m_container.size() <= p_id )
            m_container.resize( p_id + 1 );

        m_container[p_id].SetID( p_id );
        return m_container[p_id];
    }

    entityid findname( const std::string& p_name )
    {
        container::iterator itr = m_container.begin();
        stringmatchfull matcher( p_name );

        while( itr != m_container.end() )
        {
            if( matcher( itr->Name() ) )
                return itr->ID();
            ++itr;
        }
        return 0;
    }

};  // end class VectorDatabase
Uys of Spades
  • 173
  • 1
  • 9

1 Answers1

2

Not sure that this is creating the error, but first of all you have to declare

typedef typename container::iterator iterator;

that is, use the extra typename in the declaration, as container is a dependent typename, see Where and why do I have to put the "template" and "typename" keywords?

Also, is the type entityid in bool isvalid( entityid p_id ) and the rest defined somewhere?

Community
  • 1
  • 1
vsoftco
  • 55,410
  • 12
  • 139
  • 252