SDK .dll compiling errors help :-)

Lib.Spi't

Overlord of the Wasteland
Joined
Feb 12, 2009
Messages
3,708
Location
UK
ok guys I have managed to fix some of the errors that were thrown up but this has me stumped..any help in teasing out the info from the errors would be great, I can't see any faults with the code, but I also don't fully know what it is doing :)

I am happy to provide the code files to anyone that can help :)

I have managed to get it down from 20 errors to 12, I just really need some help understanding what to do with these last ones!

Cheers guys!

Spoiler :

1>CvUnit.cpp
1>CvUnit.cpp(5317) : error C2059: syntax error : 'else'
1>CvUnit.cpp(5318) : error C2447: '{' : missing function header (old-style formal list?)
1>CvUnit.cpp(5323) : error C2501: 'changeMoves' : missing storage-class or type specifiers
1>CvUnit.cpp(5325) : error C2059: syntax error : 'if'
1>CvUnit.cpp(5326) : error C2447: '{' : missing function header (old-style formal list?)
1>CvUnit.cpp(5337) : error C2059: syntax error : 'if'
1>CvUnit.cpp(5338) : error C2447: '{' : missing function header (old-style formal list?)
1>CvUnit.cpp(5341) : error C2447: '{' : missing function header (old-style formal list?)
1>CvUnit.cpp(5346) : error C2761: 'bool CvUnit::canPlunder(const CvPlot *,bool) const' : member function redeclaration not allowed
1>CvUnit.cpp(5347) : error C2447: '{' : missing function header (old-style formal list?)
1>NMAKE : fatal error U1077: '"C:\Program Files\Microsoft Visual C++ Toolkit 2003\bin\cl.exe"' : return code '0x2'
1>Stop.
 
This is line 316-351 do you see the problem? because I keep looking but don't see what I am missing..

Code:
}
	else if (pPlot->isRoute());
	{
		eTempRoute = pPlot->getRouteType();
		pPlot->setRouteType(NO_ROUTE, true); // XXX downgrade rail???
	}

	changeMoves(GC.getMOVE_DENOMINATOR());

	if (pPlot->isActiveVisible(false));
	{
		// Pillage entity mission
		CvMissionDefinition kDefiniton;
		kDefiniton.setMissionTime(GC.getMissionInfo(MISSION_PILLAGE).getTime() * gDLL->getSecsPerTurn());
		kDefiniton.setMissionType(MISSION_PILLAGE);
		kDefiniton.setPlot(pPlot);
		kDefiniton.setUnit(BATTLE_UNIT_ATTACKER, this);
		kDefiniton.setUnit(BATTLE_UNIT_DEFENDER, NULL);
		gDLL->getEntityIFace()->AddMission(&kDefiniton);
	}

	if (eTempImprovement != NO_IMPROVEMENT || eTempRoute != NO_ROUTE);
	{
		CvEventReporter::getInstance().unitPillage(this, eTempImprovement, eTempRoute, getOwnerINLINE());
	}
	{
		return true;
	}


bool CvUnit::canPlunder(const CvPlot* pPlot, bool bTestVisible) const;
{
	if (getDomainType() != DOMAIN_SEA)
	{
		return false;
 
If the indentation of line 5316 is any indication, that } there probably closes bool CvUnit::pillage() - which is why the else in 5317 throws a syntax error. Can't confirm that though, since you didn't upload the file, neither did you paste the relevant parts of the code.
 
In the code you posted in the 3rd post, move the top } down to just above bool CvUnit::canPlunder

It's causing the function to close before all the rest of the code is read. So everything after else if (pPlot->isRoute()); down to the next function is just free-floating code, which is not allowed.
 
ok got that done.

Code:
	else if (pPlot->isRoute());
	
	{
		eTempRoute = pPlot->getRouteType();
		pPlot->setRouteType(NO_ROUTE, true); // XXX downgrade rail???
	}

	changeMoves(GC.getMOVE_DENOMINATOR());

	if (pPlot->isActiveVisible(false));
	{
		// Pillage entity mission
		CvMissionDefinition kDefiniton;
		kDefiniton.setMissionTime(GC.getMissionInfo(MISSION_PILLAGE).getTime() * gDLL->getSecsPerTurn());
		kDefiniton.setMissionType(MISSION_PILLAGE);
		kDefiniton.setPlot(pPlot);
		kDefiniton.setUnit(BATTLE_UNIT_ATTACKER, this);
		kDefiniton.setUnit(BATTLE_UNIT_DEFENDER, NULL);
		gDLL->getEntityIFace()->AddMission(&kDefiniton);
	}

	if (eTempImprovement != NO_IMPROVEMENT || eTempRoute != NO_ROUTE);
	{
		CvEventReporter::getInstance().unitPillage(this, eTempImprovement, eTempRoute, getOwnerINLINE());
	}
	{
		return true;
[COLOR="Red"]}[/COLOR]
bool CvUnit::canPlunder(const CvPlot* pPlot, bool bTestVisible) const;
{
	if (getDomainType() != DOMAIN_SEA)
	{
		return false;
	}

	if (!(m_pUnitInfo->isPillage()))
	{
		return false;
	}

	if (!pPlot->isWater())
	{
		return false;
	}

	if (pPlot->isFreshWater())
	{
		return false;
	}

	if (!pPlot->isValidDomainForAction(*this))
	{
		return false;
	}

	if (!bTestVisible)
	{
		if (pPlot->getTeam() == getTeam())
		{
			return false;
		}
	}

	return true;
}

now 5 errors

1>CvUnit.cpp(5317) : error C2181: illegal else without matching if
1>CvUnit.cpp(5319) : warning C4390: ';' : empty controlled statement found; is this the intent?
1>CvUnit.cpp(5327) : warning C4390: ';' : empty controlled statement found; is this the intent?
1>CvUnit.cpp(5339) : warning C4390: ';' : empty controlled statement found; is this the intent?
1>CvUnit.cpp(5346) : error C2761: 'bool CvUnit::canPlunder(const CvPlot *,bool) const' : member function redeclaration not allowed
1>CvUnit.cpp(5347) : error C2447: '{' : missing function header (old-style formal list?)
1>NMAKE : fatal error U1077: '"C:\Program Files\Microsoft Visual C++ Toolkit 2003\bin\cl.exe"' : return code '0x2'
1>Stop.

thanks for your help guys this has had me stumped for ages now..
 
nearly there

1>CvUnit.cpp
1>CvUnit.cpp(5317) : error C2181: illegal else without matching if
1>CvUnit.cpp(5346) : error C2447: '{' : missing function header (old-style formal list?)
1>NMAKE : fatal error U1077: '"C:\Program Files\Microsoft Visual C++ Toolkit 2003\bin\cl.exe"' : return code '0x2'
1>Stop.

I can't figure out what I am doing wrong with these last two, somethings I try freak it out and sparks off over 100 errors...
 

Attachments

  • CvUnit.rar
    59.3 KB · Views: 58
Spoiler :
1>CvUnit.cpp
1>CvUnit.cpp(5346) : error C2761: 'bool CvUnit::canPlunder(const CvPlot *,bool) const' : member function redeclaration not allowed
1>CvUnit.cpp(5347) : error C2447: '{' : missing function header (old-style formal list?)
1>NMAKE : fatal error U1077: '"C:\Program Files\Microsoft Visual C++ Toolkit 2003\bin\cl.exe"' : return code '0x2'
1>Stop.
1>Project : error PRJ0019: A tool returned an error code from "Performing Makefile project actions"
1>Build log was saved at "file://c:\Games\CivIV\2K Games\Firaxis Games\Sid Meier's Civilization 4 Complete\Beyond the Sword\Mods\Fallout Tame The Waste\CvGameCoreDLL\Debug\BuildLog.htm"
1>CvGameCoreDLL - 4 error(s), 0 warning(s)


Ok guys I am really close to understanding the problem, but I can't quite get the last litle bit. I retraced a few of the errors by comparing Kmod code to my code and found what I was doing wrong, but this last error in red, is a line of code that is only in the extrapillage mod, and not kmod (after searching for it) So I am finding it really hard to know what to look at in order to track down the change I need to make. As I do not think I have anything to compare it too and I do not understand what the error really means. The redeclaration bit... it sounds like it is doing the same bit of code twice or something...but I don't know and don't know what to look at to change it to a correct version....

Once again help is always appreciated! :)
 

Attachments

  • CvUnit.rar
    59.3 KB · Views: 54
AND HERE IS THE NEXT PROBLEM :-D that was quick!!

Spoiler :

1> Creating library Debug\CvGameCoreDLL.lib and object Debug\CvGameCoreDLL.exp
1>CvUnit.obj : error LNK2019: unresolved external symbol "public: int __thiscall CvPlayerAI::AI_getEnemyPlotStrength(class CvPlot *,int,bool,bool)const " (?AI_getEnemyPlotStrength@CvPlayerAI@@QBEHPAVCvPlot@@H_N1@Z) referenced in function "public: bool __thiscall CvUnit::pillage(void)" (?pillage@CvUnit@@QAE_NXZ)
1>CvUnit.obj : error LNK2019: unresolved external symbol "public: int __thiscall CvPlayerAI::AI_getOurPlotStrength(class CvPlot *,int,bool,bool)const " (?AI_getOurPlotStrength@CvPlayerAI@@QBEHPAVCvPlot@@H_N1@Z) referenced in function "public: bool __thiscall CvUnit::pillage(void)" (?pillage@CvUnit@@QAE_NXZ)
1>Debug\CvGameCoreDLL.dll : fatal error LNK1120: 2 unresolved externals
1>NMAKE : fatal error U1077: '"C:\Program Files\Microsoft Visual C++ Toolkit 2003\bin\link.exe"' : return code '0x460'
1>Stop.


as ever all help appreciated!

I think i may have not copied a bit of code to something, presumably about the AI....but I don't know where to begin looking for it or where it would need to go...

HELP!!
 
Spoiler :
1>KmodPathFinder.cpp
1> "C:\Program Files\Microsoft SDKs\bin\rc.exe" /FoRelease\CvGameCoreDLL.res /IBoost-1.32.0/include /IPython24/include /I"C:\Program Files\Microsoft Visual C++ Toolkit 2003/include" /I"C:\Program Files\Microsoft SDKs/Include" /I"C:\Program Files\Microsoft SDKs/Include/mfc" CvGameCoreDLL.rc
1>'C:\Program' is not recognized as an internal or external command,
1>operable program or batch file.
1>NMAKE : fatal error U1077: '"C:\Program Files\Microsoft SDKs\bin\rc.exe' : return code '0x1'
1>Stop.
1>Project : error PRJ0019: A tool returned an error code from "Performing Makefile project actions"
1>Build log was saved at "file://c:\Games\CivIV\2K Games\Firaxis Games\Sid Meier's Civilization 4 Complete\Beyond the Sword\Mods\Fallout Tame The Waste\CvGameCoreDLL\Release\BuildLog.htm"
1>CvGameCoreDLL - 2 error(s), 0 warning(s)


ok now I am really confused... I just ran the build again....without changing anything and got a different set of errors and these ones I really cannot make head or tail of?!?!?!
 
Ok it seems I solvede this new error by downloading the 7.1 version of windows sdks, we are now back to the previous error

Spoiler :
1>------ Build started: Project: CvGameCoreDLL, Configuration: Release Win32 ------
1>Performing Makefile project actions
1>Microsoft (R) Program Maintenance Utility Version 9.00.30729.01
1>Copyright (C) Microsoft Corporation. All rights reserved.
1> "C:\Program Files\Microsoft SDKs\Windows\v7.1\bin\rc.exe" /FoRelease\CvGameCoreDLL.res /IBoost-1.32.0/include /IPython24/include /I"C:\Program Files\Microsoft Visual C++ Toolkit 2003/include" /I"C:\Program Files\Microsoft SDKs\Windows\v7.1/Include" /I"C:\Program Files\Microsoft SDKs\Windows\v7.1/Include/mfc" CvGameCoreDLL.rc
1>Microsoft (R) Windows (R) Resource Compiler Version 6.1.6723.1
1>Copyright (C) Microsoft Corporation. All rights reserved.
1> "C:\Program Files\Microsoft Visual C++ Toolkit 2003\bin\link.exe" /out:Release\CvGameCoreDLL.dll /INCREMENTAL:NO /OPT:REF /OPT:ICF /PDB:"Release\CvGameCoreDLL.pdb" /DLL /NOLOGO /SUBSYSTEM:WINDOWS /LARGEADDRESSAWARE /TLBID:1 /LIBPATH:python24/libs /LIBPATH:boost-1.32.0/libs/ boost_python-vc71-mt-1_32.lib /LIBPATH:"C:\Program Files\Microsoft Visual C++ Toolkit 2003/lib" /LIBPATH:"C:\Program Files\Microsoft SDKs\Windows\v7.1/Lib" winmm.lib user32.lib Release\BetterBTSAI.obj Release\CvArea.obj Release\CvArtFileMgr.obj Release\CvBugOptions.obj Release\CvCity.obj Release\CvCityAI.obj Release\CvDeal.obj Release\CvDiploParameters.obj Release\CvDLLButtonPopup.obj Release\CvDLLEntity.obj Release\CvDLLPython.obj Release\CvDllPythonEvents.obj Release\CvDllTranslator.obj Release\CvDLLWidgetData.obj Release\CvEventReporter.obj Release\CvFractal.obj Release\CvGame.obj Release\CvGameAI.obj Release\CvGameCoreDLL.obj Release\CvGameCoreUtils.obj Release\CvGameInterface.obj Release\CvGameTextMgr.obj Release\CvGlobals.obj Release\CvHallOfFameInfo.obj Release\CvInfos.obj Release\CvInfoWater.obj Release\CvInitCore.obj Release\CvMap.obj Release\CvMapGenerator.obj Release\CvMessageControl.obj Release\CvMessageData.obj Release\CvPlayer.obj Release\CvPlayerAI.obj Release\CvPlot.obj Release\CvPlotGroup.obj Release\CvPopupInfo.obj Release\CvPopupReturn.obj Release\CvRandom.obj Release\CvReplayInfo.obj Release\CvReplayMessage.obj Release\CvSelectionGroup.obj Release\CvSelectionGroupAI.obj Release\CvStatistics.obj Release\CvStructs.obj Release\CvTalkingHeadMessage.obj Release\CvTeam.obj Release\CvTeamAI.obj Release\CvTextScreens.obj Release\CvUnit.obj Release\CvUnitAI.obj Release\CvXMLLoadUtility.obj Release\CvXMLLoadUtilityGet.obj Release\CvXMLLoadUtilityInit.obj Release\CvXMLLoadUtilitySet.obj Release\CyArea.obj Release\CyAreaInterface.obj Release\CyArgsList.obj Release\CyArtFileMgr.obj Release\CyArtFileMgrInterface.obj Release\CyCity.obj Release\CyCityInterface1.obj Release\CyDeal.obj Release\CyEnumsInterface.obj Release\CyGame.obj Release\CyGameCoreUtils.obj Release\CyGameCoreUtilsInterface.obj Release\CyGameInterface.obj Release\CyGameTextMgr.obj Release\CyGameTextMgrInterface.obj Release\CyGlobalContext.obj Release\CyGlobalContextInterface1.obj Release\CyGlobalContextInterface2.obj Release\CyGlobalContextInterface3.obj Release\CyGlobalContextInterface4.obj Release\CyHallOfFameInfo.obj Release\CyHallOfFameInterface.obj Release\CyInfoInterface1.obj Release\CyInfoInterface2.obj Release\CyInfoInterface3.obj Release\CyMap.obj Release\CyMapGenerator.obj Release\CyMapGeneratorInterface.obj Release\CyMapInterface.obj Release\CyMessageControl.obj Release\CyMessageControlInterface.obj Release\CyPlayer.obj Release\CyPlayerInterface1.obj Release\CyPlayerInterface2.obj Release\CyPlot.obj Release\CyPlotInterface1.obj Release\CyRandomInterface.obj Release\CyReplayInfo.obj Release\CySelectionGroup.obj Release\CySelectionGroupInterface.obj Release\CyStructsInterface1.obj Release\CyTeam.obj Release\CyTeamInterface.obj Release\CyUnit.obj Release\CyUnitInterface1.obj Release\FAssert.obj Release\FDialogTemplate.obj Release\KmodPathFinder.obj Release\_precompile.obj Release\CvGameCoreDLL.res
1> Creating library Release\CvGameCoreDLL.lib and object Release\CvGameCoreDLL.exp
1>CvUnit.obj : error LNK2019: unresolved external symbol "public: int __thiscall CvPlayerAI::AI_getEnemyPlotStrength(class CvPlot *,int,bool,bool)const " (?AI_getEnemyPlotStrength@CvPlayerAI@@QBEHPAVCvPlot@@H_N1@Z) referenced in function "public: bool __thiscall CvUnit::pillage(void)" (?pillage@CvUnit@@QAE_NXZ)
1>CvUnit.obj : error LNK2019: unresolved external symbol "public: int __thiscall CvPlayerAI::AI_getOurPlotStrength(class CvPlot *,int,bool,bool)const " (?AI_getOurPlotStrength@CvPlayerAI@@QBEHPAVCvPlot@@H_N1@Z) referenced in function "public: bool __thiscall CvUnit::pillage(void)" (?pillage@CvUnit@@QAE_NXZ)
1>Release\CvGameCoreDLL.dll : fatal error LNK1120: 2 unresolved externals
1>NMAKE : fatal error U1077: '"C:\Program Files\Microsoft Visual C++ Toolkit 2003\bin\link.exe"' : return code '0x460'
1>Stop.
1>Project : error PRJ0019: A tool returned an error code from "Performing Makefile project actions"
1>Build log was saved at "file://c:\Games\CivIV\2K Games\Firaxis Games\Sid Meier's Civilization 4 Complete\Beyond the Sword\Mods\Fallout Tame The Waste\CvGameCoreDLL\Release\BuildLog.htm"
1>CvGameCoreDLL - 5 error(s), 0 warning(s)
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========


grrrr I have done a find all search, and it doesn't find either code reference in any of the files....I am sure they look familiar I just can't think from where...
 
It sounds like the problems are arising due to combinations of incompatible bits of code.

When it says stuff like "unresolved external symbol [blah blah blah]", basically that means that there is some function which is declared (in the .h files), but is not defined (in the .cpp files).

AI_getEnemyPlotStrength and AI_getOurPlotStrength are functions which K-Mod has removed; so if you're using the K-Mod .cpp files, then those functions will be missing. (They have been superseded by new functions: AI_localDefenceStrength and AI_localAttackStrength.)

To fix the problem you can either delete (or just comment out) any reference to AI_getEnemyPlotStrength in the header files; and if there are any references to it in the .cpp files, replace it with a corresponding call to one of the new functions. -- Or alternatively, you could restore the original definition of the deleted functions so that both sets of functions exist...

I'm not sure about the CvUnit::pillage one. Again, it sounds like the problem is that it is declared but not defined; but I don't think I've changed that particular function in any way.
 
ok I think I found the offending code and changed it, new error!!! :p

do I just need to change int to teamtype? or is the an abomb waiting to happen??

Spoiler :
1>CvUnit.cpp
1>CvUnit.cpp(5258) : error C2664: 'CvPlayerAI::AI_localDefenceStrength' : cannot convert parameter 2 from 'int' to 'TeamTypes'
1> Conversion to enumeration type requires an explicit cast (static_cast, C-style cast or function-style cast)
1>CvUnit.cpp(5259) : error C2664: 'CvPlayerAI::AI_localAttackStrength' : cannot convert parameter 2 from 'int' to 'TeamTypes'
1> Conversion to enumeration type requires an explicit cast (static_cast, C-style cast or function-style cast)


here are the lines of code:

Code:
 if (GET_PLAYER(ePillagedPlayer).getPillagePartisanChance() > 0)
                {
                    int iOurDefense = GET_PLAYER(ePillagedPlayer).AI_localDefenceStrength(plot(), 0, true, false);
                    int iEnemyOffense = GET_PLAYER(ePillagedPlayer).AI_localAttackStrength(plot(), 2, true, false, false);
                    int iRatio = (100 * iEnemyOffense) / (std::max(1, iOurDefense));

and the two bits of kmod code it now points to:

Code:
int AI_localDefenceStrength(const CvPlot* pDefencePlot, TeamTypes eDefenceTeam, DomainTypes eDomainType = DOMAIN_LAND, int iRange = 0, bool bAtTarget = true, bool bCheckMoves = false) const;
	int AI_localAttackStrength(const CvPlot* pTargetPlot, TeamTypes eAttackTeam, DomainTypes eDomainType = DOMAIN_LAND, int iRange = 2, bool bUseTarget = true, bool bCheckMoves = false, bool bCheckCanAttack = false) const;
 
Top Bottom