Search code examples
c++undefinedheader-filescodewarrior

Undefined identifiers


I am trying to recompile source code of an old game, which was not coded by me and I've no idea which compiler was used to compile this.

I am getting undefined identifier errors in a file which I couldn't figure out. The errors are like this:

Error : Undefined identifier 'begin'  
Error : Undefined identifier 'capacity'  
Error : Undefined identifier 'size'  
Error : Undefined identifier 'back'  
Error : Undefined identifier 'pop_back'  

I am pretty sure I am missing one or two header files. Any idea which headers I am missing there?

Here are the code lines which are giving errors:

const OzU32 nCapacity = OzU32(capacity());
const OzU32 nAllocated = Capacity() - OzU32(size());
std::transform(
            m_pPoolMemory, 
            m_pPoolMemory + nCapacity, 
            begin(), 
            std::ptr_fun(SetPointer<Type>));

PS: I am using CodeWarrior IDE, if that helps.


Solution

  • Actually there were some other header files, which have the same method names, causing the compiler confusion. So I just added the vector namespace in front of the method name to work it out. Like this -

    vector<Type>::begin()
    

    And yeah it was vector.