View Full Version : [SDK ERROR] Error C3861, identifier not found, even with argument-dependent lookup


Grave
Jul 26, 2007, 01:23 PM
While compiling my SDK for Beyond the Sword, I came across this error:


Project : CvGameCoreDLL
Compiler : Microsoft Visual C++ Toolkit 2003 (called directly)
Directory : C:\Games\Sid Meier's Civilization IV\Beyond the Sword\CvGameCoreDLL\
--------------------------------------------------------------------------------
Switching to target: Final Release
CvCity.cpp
CvCity.cpp(7883) : error C3861: 'hasActiveBuilding': identifier not found, even with argument-dependent lookup
CvCity.cpp(8404) : error C3861: 'hasActiveBuilding': identifier not found, even with argument-dependent lookup
Process terminated with status 1 (0 minutes, 6 seconds)
2 errors, 0 warnings


Here is the code that is affected by the first error (see red font):


// Grave's History in the Making Component: Changes Start
int CvCity::getBuildingYieldChange(YieldTypes eIndex) const
{
FAssertMsg(eIndex >= 0, "eIndex expected to be >= 0");
FAssertMsg(eIndex < NUM_YIELD_TYPES, "eIndex expected to be < NUM_YIELD_TYPES");
return m_aiBuildingYieldChange[eIndex];
}

void CvCity::changeBuildingYieldChange(YieldTypes eIndex, int iChange)
{

FAssertMsg(eIndex >= 0, "eIndex expected to be >= 0");
FAssertMsg(eIndex < NUM_YIELD_TYPES, "eIndex expected to be < NUM_YIELD_TYPES");

if (iChange != 0)
{
m_aiBuildingYieldChange[eIndex] = (m_aiBuildingYieldChange[eIndex] + iChange);
FAssert(getYieldRate(eIndex) >= 0);

if (eIndex == YIELD_COMMERCE)
{
updateCommerce();
}

AI_setAssignWorkDirty(true);

if (getTeam() == GC.getGameINLINE().getActiveTeam())
{
setInfoDirty(true);
}
}
}

void CvCity::updateBuildingYieldChange()
{
int iI, iJ;


for (iI = 0; iI < NUM_YIELD_TYPES; iI++)
{
m_aiBuildingYieldChange[iI] = 0;
}

for (iI = 0; iI < GC.getNumBuildingInfos(); iI++)
{
if (hasActiveBuilding((BuildingTypes)iI))
{

for (iJ = 0; iJ < NUM_YIELD_TYPES; iJ++)
{
changeBuildingYieldChange((YieldTypes)iJ, GET_PLAYER(getOwnerINLINE()).getBuildingYieldChang e((BuildingTypes)iI, (YieldTypes)iJ));
}
}
}

AI_setAssignWorkDirty(true);

if (getTeam() == GC.getGameINLINE().getActiveTeam())
{
setInfoDirty(true);
}
}
// Grave's History in the Making Component: Changes End


And here is the second error:


// < Grave's History in the Making Component: Changes Start >
int CvCity::getBuildingCommerceChange(CommerceTypes eIndex) const
{
FAssertMsg(eIndex >= 0, "eIndex expected to be >= 0");
FAssertMsg(eIndex < NUM_COMMERCE_TYPES, "eIndex expected to be < NUM_YIELD_TYPES");
return m_aiBuildingCommerceChange[eIndex];
}

void CvCity::changeBuildingCommerceChange(CommerceTypes eIndex, int iChange)
{

FAssertMsg(eIndex >= 0, "eIndex expected to be >= 0");
FAssertMsg(eIndex < NUM_COMMERCE_TYPES, "eIndex expected to be < NUM_YIELD_TYPES");

if (iChange != 0)
{
m_aiBuildingCommerceChange[eIndex] = (m_aiBuildingCommerceChange[eIndex] + iChange);
FAssert(getCommerceRate(eIndex) >= 0);

if (eIndex == YIELD_COMMERCE)
{
updateCommerce();
}

AI_setAssignWorkDirty(true);

if (getTeam() == GC.getGameINLINE().getActiveTeam())
{
setInfoDirty(true);
}
}
}

void CvCity::updateBuildingCommerceChange()
{
int iI, iJ;


for (iI = 0; iI < NUM_COMMERCE_TYPES; iI++)
{
m_aiBuildingCommerceChange[iI] = 0;
}

for (iI = 0; iI < GC.getNumBuildingInfos(); iI++)
{
if (hasActiveBuilding((BuildingTypes)iI))
{

for (iJ = 0; iJ < NUM_COMMERCE_TYPES; iJ++)
{
changeBuildingCommerceChange((CommerceTypes)iJ, GET_PLAYER(getOwnerINLINE()).getBuildingCommerceCh ange((BuildingTypes)iI, (CommerceTypes)iJ));
}
}
}

AI_setAssignWorkDirty(true);

if (getTeam() == GC.getGameINLINE().getActiveTeam())
{
setInfoDirty(true);
}
}
// < Grave's History in the Making Component: Changes End >




Any suggestions on how to fix this? :(

Grave
Jul 27, 2007, 11:07 AM
To the top. Still looking for help with this!

matthewv
Jul 27, 2007, 11:21 AM
As the error says, "hasActiveBuilding" is not defined at all and thus you have to define it to use it.

Grave
Jul 27, 2007, 11:22 AM
As the error says, "hasActiveBuilding" is not defined at all and thus you have to define it to use it.


I know that. ;)

How would I define it then? Would it be in the .h file, in the .cpp file? I'm not sure how I would go about defing it. :confused:

Grave
Jul 27, 2007, 11:38 AM
Ok, I figured it out. :blush:

I changed: if (hasActiveBuilding((BuildingTypes)iI))

To: if (getNumActiveBuilding((BuildingTypes)iI))


Then it compiled.

Mexico
Jul 27, 2007, 02:41 PM
Ok, I figured it out. :blush:

I changed: if (hasActiveBuilding((BuildingTypes)iI))

To: if (getNumActiveBuilding((BuildingTypes)iI))


Then it compiled.

there is no hasActiveBuilding() method, proper form is isHasActiveBuilding()

Grave
Jul 27, 2007, 02:43 PM
there is no hasActiveBuilding() method, proper form is isHasActiveBuilding()


Ok, I'll give that one a shot.


Thanks! :goodjob: