Link to home
Start Free TrialLog in
Avatar of Lou1
Lou1Flag for United States of America

asked on

error LNK2019: unresolved external symbol "public: bool __thiscall

Hi all, I am working on a videogame being developed in C++. We use Ogre as our graphics engine.

I get the following error:

1>HostAPI.obj : error LNK2019: unresolved external symbol "public: bool __thiscall Star::ContainerManager::objectsInZone(int,bool,class Star::Container &,class std::vector<int,class std::allocator<int> > &)

Here is the portion of code in class HostAPI.cpp where the error occurs:

int allSuppliesInShelter(lua_State* pLuaState)
{
         int zoneID = static_cast<int>(lua_tonumber(pLuaState,1));
         Container& parentNode = *(Star::ContainerManager::getSingleton().getRoot());
         std::vector<int> objectTypes;
         objectTypes.push_back(71);

         bool allSuppliesInShelter = Star::ContainerManager::getSingleton().objectsInZone(zoneID, true, parentNode, objectTypes);

         lua_pushboolean(pLuaState, true);

         return 1;
} // End allSuppliesInShelter

The function objectsInZone is defined as Public in class ContainerManager as follows:

bool objectsInZone(int zoneID, bool allObjects, Container& parentNode, std::vector<int>& objectTypes)
{
        ContainerMap::iterator contentsIterator;

        for (contentsIterator = parentNode.getContents()->begin(); contentsIterator != parentNode.getContents()->end(); contentsIterator++)
        {
                    Star::Logger::getSingletonPtr()->logf(Star::Logger::LOG_TRIVIAL, "The objectType of the object is %d", (contentsIterator->second)->getObjectType());

                    if ((contentsIterator->second)->getObjectType() == 71)
        {
              //if (allObjects)
              //{
            // In case all objects of the types specified have to be in the zone.
                        
            //} // End if (allObjects)
      } // End if ((contentsIterator->second)->getObjectType() == 71)
      } // End for

      if (allObjects)
      {
             return true;
       } // End if
       else
       {
              return false;
        } // End else
} // End objectsInZone

Class ContainerManager is included in HostAPI.cpp:

#include <ContainerManager/ContainerManager.h>

Does anybody know why this error could be occuring?
ASKER CERTIFIED SOLUTION
Avatar of jkr
jkr
Flag of Germany image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Lou1

ASKER

duh, you were both right. It was a namespace problem, all I had to do was declare the function like so:

bool ContainerManager::objectsInZone(int zoneID, bool allObjects, Container& parentNode, std::vector<int>& objectTypes)