Help- C++ compile error

Joined
Sep 24, 2007
Messages
108
Location
Houston,TX
EDIT: PROBLEM RESOLVED PLEASE SEE POST #18

I'm trying to compile 2 different mod components (Route Pillage mod, and Influence War mod) into one mod, and this is the last file that I just can't seem to make it work. As far as I can tell, the problem is in line 4259 of the CvUnit.cpp file. Error C2181 (illegal else without matching if). I've tried numerous little changes but nothing seems to work :(. Any help would be greatly appreciated!
Below is the exact error. http://forums.civfanatics.com/uploads/127508/CvUnit.zip

Performing Makefile project actions
Microsoft (R) Program Maintenance Utility Version 8.00.50727.42
Copyright (C) Microsoft Corporation. All rights reserved.
"C:\Program Files\Microsoft Visual C++ Toolkit 2003/bin/cl.exe" /nologo /MD /Gd /G7 /GR /O2 /W3 /EHsc /DWIN32 /DNDEBUG /D_WINDOWS /D_USRDLL /DCVGAMECOREDLL_EXPORTS /DFINAL_RELEASE /IBoost-1.32.0/include /IPython24/include /I"C:\Program Files\Microsoft Visual C++ Toolkit 2003/include" /I"C:\Program Files\Microsoft Platform SDK/Include" /c CvUnit.cpp /FoFinal_Release/CvUnit.obj
CvUnit.cpp
CvUnit.cpp(4259) : error C2181: illegal else without matching if
NMAKE : fatal error U1077: '"C:\Program Files\Microsoft Visual C++ Toolkit 2003/bin/cl.exe"' : return code '0x2'
Stop.
Project : error PRJ0019: A tool returned an error code from "Performing Makefile project actions"
 
Moderator Action: Thread moved. Hopefully someone in this subforum can help.
 
Yep, I got major errors when trying to compile. All I did was try to compile the original 3.13 BTS source code (i.e. I had made no changes) and I got 42 errors and 2 warnings. Here is the build log from CodeBlocks:

Spoiler :
Code:
CvInitCore.obj : error LNK2005: "public: void __thiscall CvInitCore::setType(enum GameType)" (?setType@CvInitCore@@QAEXW4GameType@@@Z) already defined in CvDLLButtonPopup.obj
CvInitCore.obj : error LNK2005: "public: void __thiscall CvInitCore::setMode(enum GameMode)" (?setMode@CvInitCore@@QAEXW4GameMode@@@Z) already defined in CvDLLButtonPopup.obj
CvInitCore.obj : warning LNK4006: "public: void __thiscall CvInitCore::setType(enum GameType)" (?setType@CvInitCore@@QAEXW4GameType@@@Z) already defined in CvDLLButtonPopup.obj; second definition ignored
CvInitCore.obj : warning LNK4006: "public: void __thiscall CvInitCore::setMode(enum GameMode)" (?setMode@CvInitCore@@QAEXW4GameMode@@@Z) already defined in CvDLLButtonPopup.obj; second definition ignored
   Creating library ..\Beyond the Sword\Assets\CvGameCoreDLL.lib and object ..\Beyond the Sword\Assets\CvGameCoreDLL.exp
CvCity.obj : error LNK2019: unresolved external symbol "public: void __thiscall CvPlot::updateSight(bool)" (?updateSight@CvPlot@@QAEX_N@Z) referenced in function "public: void __thiscall CvCity::setEspionageVisibility(enum TeamTypes,bool)" (?setEspionageVisibility@CvCity@@QAEXW4TeamTypes@@_N@Z)
CvCity.obj : error LNK2019: unresolved external symbol "public: bool __thiscall CvUnit::isEnemy(enum TeamTypes)const " (?isEnemy@CvUnit@@QBE_NW4TeamTypes@@@Z) referenced in function "public: bool __thiscall CvCity::isBombardable(class CvUnit const *)const " (?isBombardable@CvCity@@QBE_NPBVCvUnit@@@Z)
CvCity.obj : error LNK2019: unresolved external symbol "public: void __thiscall CvUnit::jumpToNearestValidPlot(void)" (?jumpToNearestValidPlot@CvUnit@@QAEXXZ) referenced in function "public: void __thiscall CvCity::popOrder(int,bool,bool)" (?popOrder@CvCity@@QAEXH_N0@Z)
CvCity.obj : error LNK2019: unresolved external symbol "public: void __thiscall CvPlot::changeCultureRangeCities(enum PlayerTypes,int,int)" (?changeCultureRangeCities@CvPlot@@QAEXW4PlayerTypes@@HH@Z) referenced in function "public: void __thiscall CvCity::setCultureLevel(enum CultureLevelTypes)" (?setCultureLevel@CvCity@@QAEXW4CultureLevelTypes@@@Z)
CvCity.obj : error LNK2019: unresolved external symbol "public: void __thiscall CvPlayer::acquireCity(class CvCity *,bool,bool)" (?acquireCity@CvPlayer@@QAEXPAVCvCity@@_N1@Z) referenced in function "public: void __thiscall CvCity::liberate(void)" (?liberate@CvCity@@QAEXXZ)
CvGame.obj : error LNK2001: unresolved external symbol "public: void __thiscall CvPlayer::acquireCity(class CvCity *,bool,bool)" (?acquireCity@CvPlayer@@QAEXPAVCvCity@@_N1@Z)
CvCity.obj : error LNK2019: unresolved external symbol "public: void __thiscall CvPlot::updateCityRoute(void)" (?updateCityRoute@CvPlot@@QAEXXZ) referenced in function "public: void __thiscall CvCity::init(int,enum PlayerTypes,int,int,bool)" (?init@CvCity@@QAEXHW4PlayerTypes@@HH_N@Z)
CvCity.obj : error LNK2019: unresolved external symbol "public: void __thiscall CvPlot::changeAdjacentSight(enum TeamTypes,int,bool,enum InvisibleTypes,enum DirectionTypes)" (?changeAdjacentSight@CvPlot@@QAEXW4TeamTypes@@H_NW4InvisibleTypes@@W4DirectionTypes@@@Z) referenced in function "public: void __thiscall CvCity::init(int,enum PlayerTypes,int,int,bool)" (?init@CvCity@@QAEXHW4PlayerTypes@@HH_N@Z)
CvCity.obj : error LNK2019: unresolved external symbol "public: void __thiscall CvPlot::updateCulture(bool)" (?updateCulture@CvPlot@@QAEX_N@Z) referenced in function "public: void __thiscall CvCity::init(int,enum PlayerTypes,int,int,bool)" (?init@CvCity@@QAEXHW4PlayerTypes@@HH_N@Z)
CvCity.obj : error LNK2019: unresolved external symbol "public: void __thiscall CvPlot::setOwner(enum PlayerTypes,bool)" (?setOwner@CvPlot@@QAEXW4PlayerTypes@@_N@Z) referenced in function "public: void __thiscall CvCity::init(int,enum PlayerTypes,int,int,bool)" (?init@CvCity@@QAEXHW4PlayerTypes@@HH_N@Z)
CvCity.obj : error LNK2019: unresolved external symbol "public: void __thiscall CvPlot::setCulture(enum PlayerTypes,int,bool)" (?setCulture@CvPlot@@QAEXW4PlayerTypes@@H_N@Z) referenced in function "public: void __thiscall CvCity::init(int,enum PlayerTypes,int,int,bool)" (?init@CvCity@@QAEXHW4PlayerTypes@@HH_N@Z)
CvCityAI.obj : error LNK2019: unresolved external symbol "public: int __thiscall CvCity::getBestYieldAvailable(enum YieldTypes)const " (?getBestYieldAvailable@CvCity@@QBEHW4YieldTypes@@@Z) referenced in function "protected: int __thiscall CvCityAI::AI_yieldValue(short *,short *,bool,bool,bool,bool,bool,bool)" (?AI_yieldValue@CvCityAI@@IAEHPAF0_N11111@Z)
CvCityAI.obj : error LNK2019: unresolved external symbol "public: bool __thiscall CvCity::isSpecialistValid(enum SpecialistTypes,int)const " (?isSpecialistValid@CvCity@@QBE_NW4SpecialistTypes@@H@Z) referenced in function "protected: virtual bool __thiscall CvCityAI::AI_addBestCitizen(bool,bool,int *,enum SpecialistTypes *)" (?AI_addBestCitizen@CvCityAI@@MAE_N_N0PAHPAW4SpecialistTypes@@@Z)
CyCity.obj : error LNK2001: unresolved external symbol "public: bool __thiscall CvCity::isSpecialistValid(enum SpecialistTypes,int)const " (?isSpecialistValid@CvCity@@QBE_NW4SpecialistTypes@@H@Z)
CvDLLWidgetData.obj : error LNK2019: unresolved external symbol "public: void __thiscall CvGameTextMgr::setEventHelp(class CvWStringBuffer &,enum EventTypes,int)" (?setEventHelp@CvGameTextMgr@@QAEXAAVCvWStringBuffer@@W4EventTypes@@H@Z) referenced in function "public: void __thiscall CvDLLWidgetData::parseEventHelp(struct CvWidgetDataStruct &,class CvWStringBuffer &)" (?parseEventHelp@CvDLLWidgetData@@QAEXAAUCvWidgetDataStruct@@AAVCvWStringBuffer@@@Z)
CvDeal.obj : error LNK2019: unresolved external symbol "public: void __thiscall CvTeam::declareWar(enum TeamTypes,bool)" (?declareWar@CvTeam@@QAEXW4TeamTypes@@_N@Z) referenced in function "protected: bool __thiscall CvDeal::startTrade(struct TradeData,enum PlayerTypes,enum PlayerTypes)" (?startTrade@CvDeal@@IAE_NUTradeData@@W4PlayerTypes@@1@Z)
CvGame.obj : error LNK2001: unresolved external symbol "public: void __thiscall CvTeam::declareWar(enum TeamTypes,bool)" (?declareWar@CvTeam@@QAEXW4TeamTypes@@_N@Z)
CvGame.obj : error LNK2019: unresolved external symbol "public: void __thiscall CvPlayer::updateCitySight(bool)" (?updateCitySight@CvPlayer@@QAEX_N@Z) referenced in function "public: void __thiscall CvGame::updateCitySight(bool)" (?updateCitySight@CvGame@@QAEX_N@Z)
CvPlayer.obj : error LNK2019: unresolved external symbol "public: enum PlayerTypes __thiscall CvCity::getLiberationPlayer(bool)const " (?getLiberationPlayer@CvCity@@QBE?AW4PlayerTypes@@_N@Z) referenced in function "public: enum PlayerTypes __thiscall CvPlayer::pickConqueredCityOwner(class CvCity const &)const " (?pickConqueredCityOwner@CvPlayer@@QBE?AW4PlayerTypes@@ABVCvCity@@@Z)
CvPlayerAI.obj : error LNK2001: unresolved external symbol "public: enum PlayerTypes __thiscall CvCity::getLiberationPlayer(bool)const " (?getLiberationPlayer@CvCity@@QBE?AW4PlayerTypes@@_N@Z)
CyCity.obj : error LNK2001: unresolved external symbol "public: enum PlayerTypes __thiscall CvCity::getLiberationPlayer(bool)const " (?getLiberationPlayer@CvCity@@QBE?AW4PlayerTypes@@_N@Z)
CvPlayer.obj : error LNK2019: unresolved external symbol "public: void __thiscall CvCity::init(int,enum PlayerTypes,int,int,bool,bool)" (?init@CvCity@@QAEXHW4PlayerTypes@@HH_N1@Z) referenced in function "public: class CvCity * __thiscall CvPlayer::initCity(int,int,bool,bool)" (?initCity@CvPlayer@@QAEPAVCvCity@@HH_N0@Z)
CvPlayer.obj : error LNK2019: unresolved external symbol "public: void __thiscall CvCity::kill(bool)" (?kill@CvCity@@QAEX_N@Z) referenced in function "public: void __thiscall CvPlayer::disband(class CvCity *)" (?disband@CvPlayer@@QAEXPAVCvCity@@@Z)
CvPlot.obj : error LNK2001: unresolved external symbol "public: void __thiscall CvCity::kill(bool)" (?kill@CvCity@@QAEX_N@Z)
CyCity.obj : error LNK2001: unresolved external symbol "public: void __thiscall CvCity::kill(bool)" (?kill@CvCity@@QAEX_N@Z)
CvPlayer.obj : error LNK2019: unresolved external symbol "public: void __thiscall CvCity::setCulture(enum PlayerTypes,int,bool,bool)" (?setCulture@CvCity@@QAEXW4PlayerTypes@@H_N1@Z) referenced in function "public: void __thiscall CvPlayer::found(int,int)" (?found@CvPlayer@@QAEXHH@Z)
CyCity.obj : error LNK2001: unresolved external symbol "public: void __thiscall CvCity::setCulture(enum PlayerTypes,int,bool,bool)" (?setCulture@CvCity@@QAEXW4PlayerTypes@@H_N1@Z)
CvPlayer.obj : error LNK2019: unresolved external symbol "public: void __thiscall CvCity::updateEspionageVisibility(bool)" (?updateEspionageVisibility@CvCity@@QAEX_N@Z) referenced in function "public: void __thiscall CvPlayer::acquireCity(class CvCity *,bool,bool,bool)" (?acquireCity@CvPlayer@@QAEXPAVCvCity@@_N11@Z)
CvPlayer.obj : error LNK2019: unresolved external symbol "public: void __thiscall CvCity::setCultureTimes100(enum PlayerTypes,int,bool,bool)" (?setCultureTimes100@CvCity@@QAEXW4PlayerTypes@@H_N1@Z) referenced in function "public: void __thiscall CvPlayer::acquireCity(class CvCity *,bool,bool,bool)" (?acquireCity@CvPlayer@@QAEXPAVCvCity@@_N11@Z)
CyCity.obj : error LNK2001: unresolved external symbol "public: void __thiscall CvCity::setCultureTimes100(enum PlayerTypes,int,bool,bool)" (?setCultureTimes100@CvCity@@QAEXW4PlayerTypes@@H_N1@Z)
CvPlayer.obj : error LNK2019: unresolved external symbol "public: int __thiscall CvCity::getAddedFreeSpecialistCount(enum SpecialistTypes)const " (?getAddedFreeSpecialistCount@CvCity@@QBEHW4SpecialistTypes@@@Z) referenced in function "public: void __thiscall CvPlayer::acquireCity(class CvCity *,bool,bool,bool)" (?acquireCity@CvPlayer@@QAEXPAVCvCity@@_N11@Z)
CyCity.obj : error LNK2001: unresolved external symbol "public: int __thiscall CvCity::getAddedFreeSpecialistCount(enum SpecialistTypes)const " (?getAddedFreeSpecialistCount@CvCity@@QBEHW4SpecialistTypes@@@Z)
CvPlayer.obj : error LNK2019: unresolved external symbol "public: void __thiscall CvCity::changeCulture(enum PlayerTypes,int,bool,bool)" (?changeCulture@CvCity@@QAEXW4PlayerTypes@@H_N1@Z) referenced in function "public: bool __thiscall CvPlayer::doEspionageMission(enum EspionageMissionTypes,enum PlayerTypes,class CvPlot *,int,class CvUnit *)" (?doEspionageMission@CvPlayer@@QAE_NW4EspionageMissionTypes@@W4PlayerTypes@@PAVCvPlot@@HPAVCvUnit@@@Z)
CyCity.obj : error LNK2001: unresolved external symbol "public: void __thiscall CvCity::changeCulture(enum PlayerTypes,int,bool,bool)" (?changeCulture@CvCity@@QAEXW4PlayerTypes@@H_N1@Z)
CvPlayer.obj : error LNK2019: unresolved external symbol "public: void __thiscall CvGame::addPlayer(enum PlayerTypes,enum LeaderHeadTypes,enum CivilizationTypes)" (?addPlayer@CvGame@@QAEXW4PlayerTypes@@W4LeaderHeadTypes@@W4CivilizationTypes@@@Z) referenced in function "public: bool __thiscall CvPlayer::splitEmpire(int)" (?splitEmpire@CvPlayer@@QAE_NH@Z)
CyGame.obj : error LNK2001: unresolved external symbol "public: void __thiscall CvGame::addPlayer(enum PlayerTypes,enum LeaderHeadTypes,enum CivilizationTypes)" (?addPlayer@CvGame@@QAEXW4PlayerTypes@@W4LeaderHeadTypes@@W4CivilizationTypes@@@Z)
CvUnit.obj : error LNK2019: unresolved external symbol "public: void __thiscall CvCity::changeCultureTimes100(enum PlayerTypes,int,bool,bool)" (?changeCultureTimes100@CvCity@@QAEXW4PlayerTypes@@H_N1@Z) referenced in function "public: bool __thiscall CvUnit::greatWork(void)" (?greatWork@CvUnit@@QAE_NXZ)
CyCity.obj : error LNK2001: unresolved external symbol "public: void __thiscall CvCity::changeCultureTimes100(enum PlayerTypes,int,bool,bool)" (?changeCultureTimes100@CvCity@@QAEXW4PlayerTypes@@H_N1@Z)
CyCity.obj : error LNK2019: unresolved external symbol "public: void __thiscall CvCity::liberate(bool)" (?liberate@CvCity@@QAEX_N@Z) referenced in function "public: void __thiscall CyCity::liberate(bool)" (?liberate@CyCity@@QAEX_N@Z)
..\Beyond the Sword\Assets\CvGameCoreDLL.dll : fatal error LNK1120: 26 unresolved externals
Process terminated with status 1 (0 minutes, 5 seconds)
42 errors, 2 warnings

here is a more complete log from my 2nd attempt

Spoiler :
Code:
Switching to target: Final Release
CyArtFileMgrInterface.cpp
CyCity.cpp
CyCityInterface1.cpp
CyDeal.cpp
CyEnumsInterface.cpp
CyGame.cpp
CyGameCoreUtils.cpp
CyGameCoreUtilsInterface.cpp
CyGameInterface.cpp
CyGameTextMgr.cpp
CyGameTextMgrInterface.cpp
CyGlobalContext.cpp
CyGlobalContextInterface1.cpp
CyGlobalContextInterface2.cpp
CyGlobalContextInterface3.cpp
CyGlobalContextInterface4.cpp
CyHallOfFameInfo.cpp
CyHallOfFameInterface.cpp
CyInfoInterface1.cpp
CyInfoInterface2.cpp
CyInfoInterface3.cpp
CyMap.cpp
CyMapGenerator.cpp
CyMapGeneratorInterface.cpp
CyMapInterface.cpp
CyPlayer.cpp
CyPlayerInterface1.cpp
CyPlayerInterface2.cpp
CyPlot.cpp
CyPlotInterface1.cpp
CyRandomInterface.cpp
CyReplayInfo.cpp
CySelectionGroup.cpp
CySelectionGroupInterface.cpp
CyStructsInterface1.cpp
CyTeam.cpp
CyTeamInterface.cpp
CyUnit.cpp
CyUnitInterface1.cpp
FAssert.cpp
FDialogTemplate.cpp
_precompile.cpp
Linking dynamic library: ..\Beyond the Sword\Assets\CvGameCoreDLL.dll
CvInitCore.obj : error LNK2005: "public: void __thiscall CvInitCore::setType(enum GameType)" (?setType@CvInitCore@@QAEXW4GameType@@@Z) already defined in CvDLLButtonPopup.obj
CvInitCore.obj : error LNK2005: "public: void __thiscall CvInitCore::setMode(enum GameMode)" (?setMode@CvInitCore@@QAEXW4GameMode@@@Z) already defined in CvDLLButtonPopup.obj
CvInitCore.obj : warning LNK4006: "public: void __thiscall CvInitCore::setType(enum GameType)" (?setType@CvInitCore@@QAEXW4GameType@@@Z) already defined in CvDLLButtonPopup.obj; second definition ignored
CvInitCore.obj : warning LNK4006: "public: void __thiscall CvInitCore::setMode(enum GameMode)" (?setMode@CvInitCore@@QAEXW4GameMode@@@Z) already defined in CvDLLButtonPopup.obj; second definition ignored
   Creating library ..\Beyond the Sword\Assets\CvGameCoreDLL.lib and object ..\Beyond the Sword\Assets\CvGameCoreDLL.exp
CvCity.obj : error LNK2019: unresolved external symbol "public: void __thiscall CvPlot::updateSight(bool)" (?updateSight@CvPlot@@QAEX_N@Z) referenced in function "public: void __thiscall CvCity::setEspionageVisibility(enum TeamTypes,bool)" (?setEspionageVisibility@CvCity@@QAEXW4TeamTypes@@_N@Z)
CvCity.obj : error LNK2019: unresolved external symbol "public: bool __thiscall CvUnit::isEnemy(enum TeamTypes)const " (?isEnemy@CvUnit@@QBE_NW4TeamTypes@@@Z) referenced in function "public: bool __thiscall CvCity::isBombardable(class CvUnit const *)const " (?isBombardable@CvCity@@QBE_NPBVCvUnit@@@Z)
CvCity.obj : error LNK2019: unresolved external symbol "public: void __thiscall CvUnit::jumpToNearestValidPlot(void)" (?jumpToNearestValidPlot@CvUnit@@QAEXXZ) referenced in function "public: void __thiscall CvCity::popOrder(int,bool,bool)" (?popOrder@CvCity@@QAEXH_N0@Z)
CvCity.obj : error LNK2019: unresolved external symbol "public: void __thiscall CvPlot::changeCultureRangeCities(enum PlayerTypes,int,int)" (?changeCultureRangeCities@CvPlot@@QAEXW4PlayerTypes@@HH@Z) referenced in function "public: void __thiscall CvCity::setCultureLevel(enum CultureLevelTypes)" (?setCultureLevel@CvCity@@QAEXW4CultureLevelTypes@@@Z)
CvCity.obj : error LNK2019: unresolved external symbol "public: void __thiscall CvPlayer::acquireCity(class CvCity *,bool,bool)" (?acquireCity@CvPlayer@@QAEXPAVCvCity@@_N1@Z) referenced in function "public: void __thiscall CvCity::liberate(void)" (?liberate@CvCity@@QAEXXZ)
CvGame.obj : error LNK2001: unresolved external symbol "public: void __thiscall CvPlayer::acquireCity(class CvCity *,bool,bool)" (?acquireCity@CvPlayer@@QAEXPAVCvCity@@_N1@Z)
CvCity.obj : error LNK2019: unresolved external symbol "public: void __thiscall CvPlot::updateCityRoute(void)" (?updateCityRoute@CvPlot@@QAEXXZ) referenced in function "public: void __thiscall CvCity::init(int,enum PlayerTypes,int,int,bool)" (?init@CvCity@@QAEXHW4PlayerTypes@@HH_N@Z)
CvCity.obj : error LNK2019: unresolved external symbol "public: void __thiscall CvPlot::changeAdjacentSight(enum TeamTypes,int,bool,enum InvisibleTypes,enum DirectionTypes)" (?changeAdjacentSight@CvPlot@@QAEXW4TeamTypes@@H_NW4InvisibleTypes@@W4DirectionTypes@@@Z) referenced in function "public: void __thiscall CvCity::init(int,enum PlayerTypes,int,int,bool)" (?init@CvCity@@QAEXHW4PlayerTypes@@HH_N@Z)
CvCity.obj : error LNK2019: unresolved external symbol "public: void __thiscall CvPlot::updateCulture(bool)" (?updateCulture@CvPlot@@QAEX_N@Z) referenced in function "public: void __thiscall CvCity::init(int,enum PlayerTypes,int,int,bool)" (?init@CvCity@@QAEXHW4PlayerTypes@@HH_N@Z)
CvCity.obj : error LNK2019: unresolved external symbol "public: void __thiscall CvPlot::setOwner(enum PlayerTypes,bool)" (?setOwner@CvPlot@@QAEXW4PlayerTypes@@_N@Z) referenced in function "public: void __thiscall CvCity::init(int,enum PlayerTypes,int,int,bool)" (?init@CvCity@@QAEXHW4PlayerTypes@@HH_N@Z)
CvCity.obj : error LNK2019: unresolved external symbol "public: void __thiscall CvPlot::setCulture(enum PlayerTypes,int,bool)" (?setCulture@CvPlot@@QAEXW4PlayerTypes@@H_N@Z) referenced in function "public: void __thiscall CvCity::init(int,enum PlayerTypes,int,int,bool)" (?init@CvCity@@QAEXHW4PlayerTypes@@HH_N@Z)
CvCityAI.obj : error LNK2019: unresolved external symbol "public: int __thiscall CvCity::getBestYieldAvailable(enum YieldTypes)const " (?getBestYieldAvailable@CvCity@@QBEHW4YieldTypes@@@Z) referenced in function "protected: int __thiscall CvCityAI::AI_yieldValue(short *,short *,bool,bool,bool,bool,bool,bool)" (?AI_yieldValue@CvCityAI@@IAEHPAF0_N11111@Z)
CvCityAI.obj : error LNK2019: unresolved external symbol "public: bool __thiscall CvCity::isSpecialistValid(enum SpecialistTypes,int)const " (?isSpecialistValid@CvCity@@QBE_NW4SpecialistTypes@@H@Z) referenced in function "protected: virtual bool __thiscall CvCityAI::AI_addBestCitizen(bool,bool,int *,enum SpecialistTypes *)" (?AI_addBestCitizen@CvCityAI@@MAE_N_N0PAHPAW4SpecialistTypes@@@Z)
CyCity.obj : error LNK2001: unresolved external symbol "public: bool __thiscall CvCity::isSpecialistValid(enum SpecialistTypes,int)const " (?isSpecialistValid@CvCity@@QBE_NW4SpecialistTypes@@H@Z)
CvDLLWidgetData.obj : error LNK2019: unresolved external symbol "public: void __thiscall CvGameTextMgr::setEventHelp(class CvWStringBuffer &,enum EventTypes,int)" (?setEventHelp@CvGameTextMgr@@QAEXAAVCvWStringBuffer@@W4EventTypes@@H@Z) referenced in function "public: void __thiscall CvDLLWidgetData::parseEventHelp(struct CvWidgetDataStruct &,class CvWStringBuffer &)" (?parseEventHelp@CvDLLWidgetData@@QAEXAAUCvWidgetDataStruct@@AAVCvWStringBuffer@@@Z)
CvDeal.obj : error LNK2019: unresolved external symbol "public: void __thiscall CvTeam::declareWar(enum TeamTypes,bool)" (?declareWar@CvTeam@@QAEXW4TeamTypes@@_N@Z) referenced in function "protected: bool __thiscall CvDeal::startTrade(struct TradeData,enum PlayerTypes,enum PlayerTypes)" (?startTrade@CvDeal@@IAE_NUTradeData@@W4PlayerTypes@@1@Z)
CvGame.obj : error LNK2001: unresolved external symbol "public: void __thiscall CvTeam::declareWar(enum TeamTypes,bool)" (?declareWar@CvTeam@@QAEXW4TeamTypes@@_N@Z)
CvGame.obj : error LNK2019: unresolved external symbol "public: void __thiscall CvPlayer::updateCitySight(bool)" (?updateCitySight@CvPlayer@@QAEX_N@Z) referenced in function "public: void __thiscall CvGame::updateCitySight(bool)" (?updateCitySight@CvGame@@QAEX_N@Z)
CvPlayer.obj : error LNK2019: unresolved external symbol "public: enum PlayerTypes __thiscall CvCity::getLiberationPlayer(bool)const " (?getLiberationPlayer@CvCity@@QBE?AW4PlayerTypes@@_N@Z) referenced in function "public: enum PlayerTypes __thiscall CvPlayer::pickConqueredCityOwner(class CvCity const &)const " (?pickConqueredCityOwner@CvPlayer@@QBE?AW4PlayerTypes@@ABVCvCity@@@Z)
CvPlayerAI.obj : error LNK2001: unresolved external symbol "public: enum PlayerTypes __thiscall CvCity::getLiberationPlayer(bool)const " (?getLiberationPlayer@CvCity@@QBE?AW4PlayerTypes@@_N@Z)
CyCity.obj : error LNK2001: unresolved external symbol "public: enum PlayerTypes __thiscall CvCity::getLiberationPlayer(bool)const " (?getLiberationPlayer@CvCity@@QBE?AW4PlayerTypes@@_N@Z)
CvPlayer.obj : error LNK2019: unresolved external symbol "public: void __thiscall CvCity::init(int,enum PlayerTypes,int,int,bool,bool)" (?init@CvCity@@QAEXHW4PlayerTypes@@HH_N1@Z) referenced in function "public: class CvCity * __thiscall CvPlayer::initCity(int,int,bool,bool)" (?initCity@CvPlayer@@QAEPAVCvCity@@HH_N0@Z)
CvPlayer.obj : error LNK2019: unresolved external symbol "public: void __thiscall CvCity::kill(bool)" (?kill@CvCity@@QAEX_N@Z) referenced in function "public: void __thiscall CvPlayer::disband(class CvCity *)" (?disband@CvPlayer@@QAEXPAVCvCity@@@Z)
CvPlot.obj : error LNK2001: unresolved external symbol "public: void __thiscall CvCity::kill(bool)" (?kill@CvCity@@QAEX_N@Z)
CyCity.obj : error LNK2001: unresolved external symbol "public: void __thiscall CvCity::kill(bool)" (?kill@CvCity@@QAEX_N@Z)
CvPlayer.obj : error LNK2019: unresolved external symbol "public: void __thiscall CvCity::setCulture(enum PlayerTypes,int,bool,bool)" (?setCulture@CvCity@@QAEXW4PlayerTypes@@H_N1@Z) referenced in function "public: void __thiscall CvPlayer::found(int,int)" (?found@CvPlayer@@QAEXHH@Z)
CyCity.obj : error LNK2001: unresolved external symbol "public: void __thiscall CvCity::setCulture(enum PlayerTypes,int,bool,bool)" (?setCulture@CvCity@@QAEXW4PlayerTypes@@H_N1@Z)
CvPlayer.obj : error LNK2019: unresolved external symbol "public: void __thiscall CvCity::updateEspionageVisibility(bool)" (?updateEspionageVisibility@CvCity@@QAEX_N@Z) referenced in function "public: void __thiscall CvPlayer::acquireCity(class CvCity *,bool,bool,bool)" (?acquireCity@CvPlayer@@QAEXPAVCvCity@@_N11@Z)
CvPlayer.obj : error LNK2019: unresolved external symbol "public: void __thiscall CvCity::setCultureTimes100(enum PlayerTypes,int,bool,bool)" (?setCultureTimes100@CvCity@@QAEXW4PlayerTypes@@H_N1@Z) referenced in function "public: void __thiscall CvPlayer::acquireCity(class CvCity *,bool,bool,bool)" (?acquireCity@CvPlayer@@QAEXPAVCvCity@@_N11@Z)
CyCity.obj : error LNK2001: unresolved external symbol "public: void __thiscall CvCity::setCultureTimes100(enum PlayerTypes,int,bool,bool)" (?setCultureTimes100@CvCity@@QAEXW4PlayerTypes@@H_N1@Z)
CvPlayer.obj : error LNK2019: unresolved external symbol "public: int __thiscall CvCity::getAddedFreeSpecialistCount(enum SpecialistTypes)const " (?getAddedFreeSpecialistCount@CvCity@@QBEHW4SpecialistTypes@@@Z) referenced in function "public: void __thiscall CvPlayer::acquireCity(class CvCity *,bool,bool,bool)" (?acquireCity@CvPlayer@@QAEXPAVCvCity@@_N11@Z)
CyCity.obj : error LNK2001: unresolved external symbol "public: int __thiscall CvCity::getAddedFreeSpecialistCount(enum SpecialistTypes)const " (?getAddedFreeSpecialistCount@CvCity@@QBEHW4SpecialistTypes@@@Z)
CvPlayer.obj : error LNK2019: unresolved external symbol "public: void __thiscall CvCity::changeCulture(enum PlayerTypes,int,bool,bool)" (?changeCulture@CvCity@@QAEXW4PlayerTypes@@H_N1@Z) referenced in function "public: bool __thiscall CvPlayer::doEspionageMission(enum EspionageMissionTypes,enum PlayerTypes,class CvPlot *,int,class CvUnit *)" (?doEspionageMission@CvPlayer@@QAE_NW4EspionageMissionTypes@@W4PlayerTypes@@PAVCvPlot@@HPAVCvUnit@@@Z)
CyCity.obj : error LNK2001: unresolved external symbol "public: void __thiscall CvCity::changeCulture(enum PlayerTypes,int,bool,bool)" (?changeCulture@CvCity@@QAEXW4PlayerTypes@@H_N1@Z)
CvPlayer.obj : error LNK2019: unresolved external symbol "public: void __thiscall CvGame::addPlayer(enum PlayerTypes,enum LeaderHeadTypes,enum CivilizationTypes)" (?addPlayer@CvGame@@QAEXW4PlayerTypes@@W4LeaderHeadTypes@@W4CivilizationTypes@@@Z) referenced in function "public: bool __thiscall CvPlayer::splitEmpire(int)" (?splitEmpire@CvPlayer@@QAE_NH@Z)
CyGame.obj : error LNK2001: unresolved external symbol "public: void __thiscall CvGame::addPlayer(enum PlayerTypes,enum LeaderHeadTypes,enum CivilizationTypes)" (?addPlayer@CvGame@@QAEXW4PlayerTypes@@W4LeaderHeadTypes@@W4CivilizationTypes@@@Z)
CvUnit.obj : error LNK2019: unresolved external symbol "public: void __thiscall CvCity::changeCultureTimes100(enum PlayerTypes,int,bool,bool)" (?changeCultureTimes100@CvCity@@QAEXW4PlayerTypes@@H_N1@Z) referenced in function "public: bool __thiscall CvUnit::greatWork(void)" (?greatWork@CvUnit@@QAE_NXZ)
CyCity.obj : error LNK2001: unresolved external symbol "public: void __thiscall CvCity::changeCultureTimes100(enum PlayerTypes,int,bool,bool)" (?changeCultureTimes100@CvCity@@QAEXW4PlayerTypes@@H_N1@Z)
CyCity.obj : error LNK2019: unresolved external symbol "public: void __thiscall CvCity::liberate(bool)" (?liberate@CvCity@@QAEX_N@Z) referenced in function "public: void __thiscall CyCity::liberate(bool)" (?liberate@CyCity@@QAEX_N@Z)
..\Beyond the Sword\Assets\CvGameCoreDLL.dll : fatal error LNK1120: 26 unresolved externals
Process terminated with status 1 (5 minutes, 55 seconds)
42 errors, 2 warnings
 
I'm trying to compile 2 different mod components (Route Pillage mod, and Influence War mod) into one mod, and this is the last file that I just can't seem to make it work. As far as I can tell, the problem is in line 4259 of the CvUnit.cpp file. Error C2181 (illegal else without matching if).

This statement:
Code:
/*** ROUTE PILLAGE MOD 4 October 2007 by Grave START ***/
	else if(pTargetPlot->getImprovementType() != NO_IMPROVEMENT)
Is illegal since it follows an 'else' statement, not an 'if' or 'if else'
statement. If you look a few lines ahead you'll see the 'else' statement.

Anyway, this entire sections shoudl be re-written:
Code:
	if (pCity != NULL)
	{
		if (!(pCity->isBombardable(this)))
		{
			return false;
		}
	}
	else
	{
		if (pTargetPlot->getImprovementType() == NO_IMPROVEMENT)
		{
			return false;
		}

		if (GC.getImprovementInfo(pTargetPlot->getImprovementType()).isPermanent())
		{
			return false;
		}

		if (GC.getImprovementInfo(pTargetPlot->getImprovementType()).getAirBombDefense() == -1)
		{
			return false;
		}
	}
/*** ROUTE PILLAGE MOD 4 October 2007 by Grave START ***/
	else if(pTargetPlot->getImprovementType() != NO_IMPROVEMENT)
	{
		/*
		if (pTargetPlot->getImprovementType() == NO_IMPROVEMENT)
		{
			return false;
		}
		*/

		if (GC.getImprovementInfo(pTargetPlot->getImprovementType()).isPermanent())
		{
			return false;
		}

		if (GC.getImprovementInfo(pTargetPlot->getImprovementType()).getAirBombDefense() == -1)
		{
			return false;
		}
	}
	else
	{
		if(pTargetPlot->getRouteType() == NO_ROUTE)
		{
			return false;
		}
	}
/*** ROUTE PILLAGE MOD 4 October 2007 by Grave END ***/

The logic is a bit repetative. Something like this is all you need:

Code:
/*** ROUTE PILLAGE MOD 4 October 2007 by Grave fix by Seven05 START ***/
	if (pCity != NULL)
	{ // Cities can't be pillaged, only bombed
		if (!(pCity->isBombardable(this)))
		{
			return false;
		}
	}
	else
	{ // All non-city plots...
		if (pTargetPlot->getImprovementType() == NO_IMPROVEMENT ||
			GC.getImprovementInfo(pTargetPlot->getImprovementType()).isPermanent() ||
			GC.getImprovementInfo(pTargetPlot->getImprovementType()).getAirBombDefense() == -1 ||
			pTargetPlot->getRouteType() == NO_ROUTE)
		{ // Nothing to pillage
			return false;
		}
	}
/*** ROUTE PILLAGE MOD 4 October 2007 by Grave END ***/

Check that for obvious errors since I typed it all in here, not in the compiler. Basically, all I did was remove the repetative logic. All this function does is return false if you can't pillage so it really doesn't need anything spectacular in it or a bunch of extra 'if' statements. I compacted them all into one, you could leave them all separated to make it easier to read and just move the check for NO_ROUTE inside the 'else' statement after the city check.
 
Yep, I got major errors when trying to compile. All I did was try to compile the original 3.13 BTS source code (i.e. I had made no changes) and I got 42 errors and 2 warnings.
Typically, all of those unresolved externals means your compiler isn't setup right. You're missing something, maybe pointing to the wrong directory in the makefile for the platform SDK? Check the thread on getting the compiler up and running you'll probably see somebody posting the exact same errors :)

Also, make sure you have the BTS version of the makefile or that will give you a bunch of errors as well.
 
The makefile is a batch of commands telling the complier what to do. For the Civ4 DLL every tutorial that I've seen has a modified makefile included but you have to dig through the thread to find a BTS compatible one. 3.13 doesn't require any changes to any makefile that will work with BTS.
 
I'm sure that I've done everything that the Installing/Using the SDK thread says. Has anyone else actually managed to compile a DLL from the base 3.13 SDK? Without any changes, just compiling it?
 
Yes, no problems using VC 2005. 3.13 didn't add any files to the SDK so if you were able to compile the SDK before 3.13 you should still be able to. Perhaps you copied over your existing project file with the one from the SDK? Does codeblocks even use the project file? There isn't a makefile in the SDK but if you followed the tutorials here you should have one, if you deleted it that could be your problem.

As an afterthought, are you doing a CLEAN build with the 3.13 source? If you aren't (or you aren't sure) that could be your problem. Make sure you go through and delete all of the intermediate objects (*.obj files and the like). I don't know what codeblocks does with them but they should be in a directory named something like 'final_release'. If you're using a makefile that is properly designed to support the clean build operation you can try that from the compiler but it's just as easy to go in and delete all of the intermediate files yourself.
 
I got the first part to work, but at the end, there is another error that just now came up:LNK2019. It says that the "emergencyConscript" is not defined (line 12765). This is from the Influence driven war mod. Any suggestions? Note that these are my first SDK changes, and I'm not writing them, just trying to combine them.


CvUnit.obj : error LNK2019: unresolved external symbol "public: void __thiscall CvCity::emergencyConscript(void)" (?emergencyConscript@CvCity@@QAEXXZ) referenced in function "protected: float __thiscall CvUnit::doVictoryInfluence(class CvUnit *,bool,bool)" (?doVictoryInfluence@CvUnit@@IAEMPAV1@_N1@Z)
Final_Release/CvGameCoreDLL.dll : fatal error LNK1120: 1 unresolved externals
NMAKE : fatal error U1077: '"C:\Program Files\Microsoft Visual C++ Toolkit 2003/bin/link.exe"' : return code '0x460'
Stop.
 
@zulu9812
This is a link to the C++ tutorial that I used, and there is a download for a modified makefile and directions for v3.13 on page 2. I followed these instructions, and I had no trouble at all compiling the original game dll.

Note that in step 1 I couldn't find the CvGameCoreDLL.vcproj.vspcc. file, but it worked anyway.

I think you've missed out the link?
 
Make sure you go through and delete all of the intermediate objects (*.obj files and the like). I don't know what codeblocks does with them but they should be in a directory named something like 'final_release'.

In the end, that's what I did. I deleted the Final Release folder and tried again: it worked. Thanks for your help.
 
Any suggestions? Note that these are my first SDK changes, and I'm not writing them, just trying to combine them.
Get yourself a good 'compare and merge' utility, it'll save you a lot of headaches and point out everything that is different between two files making the merge process rather trivial.

Anyway, the function isn't defined. This means you have to add that function from IDW to your files, in other words you missed a part :)
 
I've had no problem compiling a dll, but whenever I try to use it in a mod, the game crashes.
I have used the instructions from http://forums.civfanatics.com/showthread.php?t=196283
(BtS makefile on page 3)

I have tried just making a fairly straightforward change from Lt. Bob's 40 civs mod, which he says works fine. I followed the steps below using his source code.

Step 1: Copy source files to replace originals in CvGamecoredll folder (Note: this is a copy of the CvGamecoredll under BtS)

Step 2: Open C++ and "build solution"

Step 3: Open "Final_Release" and copy dll into Mod assets folder.

I can post any more information needed, and thanks VERY MUCH in advance for any help.
 
Top Bottom