Error C2039: 'getUnit' : is not a member of 'CvPlot'

Grave

1 Goat = 400 Horses
Joined
May 5, 2002
Messages
1,530
Location
Louisiana
I ran into this problem when compiling the BtS SDK:

Code:
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
CvArea.cpp
CvArtFileMgr.cpp
CvCity.cpp
CvCityAI.cpp
CvDLLButtonPopup.cpp
CvDLLEntity.cpp
CvDLLPython.cpp
CvDLLWidgetData.cpp
CvDeal.cpp
CvDiploParameters.cpp
CvFractal.cpp
CvGame.cpp
[COLOR="Red"]CvGame.cpp(2150) : error C2039: 'getUnit' : is not a member of 'CvPlot'
        c:\Games\Sid Meier's Civilization IV\Beyond the Sword\CvGameCoreDLL\CvPlot.h(28) : see declaration of 'CvPlot'[/COLOR]Process terminated with status 1 (0 minutes, 48 seconds)
1 errors, 0 warnings

This is the bit of code from CvPlot.h that it references:

Code:
	DllExport int getNumUnits() const;																																		// Exposed to Python
	[COLOR="Red"]DllExport CvUnit* getUnitByIndex(int iIndex) const;																													// Exposed to Python[/COLOR]
	void addUnit(CvUnit* pUnit, bool bUpdate = true);
	void removeUnit(CvUnit* pUnit, bool bUpdate = true);
	DllExport CLLNode<IDInfo>* nextUnitNode(CLLNode<IDInfo>* pNode) const;
	DllExport CLLNode<IDInfo>* prevUnitNode(CLLNode<IDInfo>* pNode) const;
	DllExport CLLNode<IDInfo>* headUnitNode() const;
	DllExport CLLNode<IDInfo>* tailUnitNode() const;

I worked around this by adding the following:

Code:
	DllExport int getNumUnits() const;																																		// Exposed to Python
[COLOR="Red"]	DllExport CvUnit* getUnitByIndex(int iIndex) const;																													// Exposed to Python[/COLOR]
[COLOR="Blue"]	// Grave's History in the Making Component Start
	DllExport CvUnit* getUnit(int iIndex) const;																													// Exposed to Python
	// Grave's History in the Making Component:  End[/COLOR]
	void addUnit(CvUnit* pUnit, bool bUpdate = true);
	void removeUnit(CvUnit* pUnit, bool bUpdate = true);
	DllExport CLLNode<IDInfo>* nextUnitNode(CLLNode<IDInfo>* pNode) const;
	DllExport CLLNode<IDInfo>* prevUnitNode(CLLNode<IDInfo>* pNode) const;
	DllExport CLLNode<IDInfo>* headUnitNode() const;
	DllExport CLLNode<IDInfo>* tailUnitNode() const;

Now, I know that's not the proper way to go around it, but when I went to compile, it worked fine. What would be the correct way to fix it?
 
I'd guess you should go to line 2150 of CvGame.cpp where it looks like you've used 'getUnit' and replace it with 'getUnitByIndex'.
 
I'd guess you should go to line 2150 of CvGame.cpp where it looks like you've used 'getUnit' and replace it with 'getUnitByIndex'.


I never thought of that.... :crazyeye:


I'll give that a shot.
 
Top Bottom