[SDK] Using Microsoft Visual C++ 2005 Express Edition

Aye, Adding breakpoints works, it is just a matter of figuring out where in the code to place it to break as early as possible. But I am loving having the process attached directly, I just hit F5 and the game loads with debugger attached :)
 
Hi all, when I compile, everything seems to go fine, until it says this:

Code:
1>CvDLLButtonPopup.obj : error LNK2019: unresolved external symbol "public: void __thiscall CvGame::selectionListGameNetMessage(int,int,int,int,int,bool,bool)" (?selectionListGameNetMessage@CvGame@@QAEXHHHHH_N0@Z) referenced in function "private: bool __thiscall CvDLLButtonPopup::launchLoadUnitPopup(class CvPopup *,class CvPopupInfo &)" (?launchLoadUnitPopup@CvDLLButtonPopup@@AAE_NPAVCvPopup@@AAVCvPopupInfo@@@Z)
1>CvDLLWidgetData.obj : error LNK2001: unresolved external symbol "public: void __thiscall CvGame::selectionListGameNetMessage(int,int,int,int,int,bool,bool)" (?selectionListGameNetMessage@CvGame@@QAEXHHHHH_N0@Z)
1>CyGame.obj : error LNK2001: unresolved external symbol "public: void __thiscall CvGame::selectionListGameNetMessage(int,int,int,int,int,bool,bool)" (?selectionListGameNetMessage@CvGame@@QAEXHHHHH_N0@Z)
1>CvDLLButtonPopup.obj : error LNK2019: unresolved external symbol "public: bool __thiscall CvGame::canDoControl(enum ControlTypes)" (?canDoControl@CvGame@@QAE_NW4ControlTypes@@@Z) referenced in function "private: bool __thiscall CvDLLButtonPopup::launchMainMenuPopup(class CvPopup *,class CvPopupInfo &)" (?launchMainMenuPopup@CvDLLButtonPopup@@AAE_NPAVCvPopup@@AAVCvPopupInfo@@@Z)
1>CvDLLButtonPopup.obj : error LNK2019: unresolved external symbol "public: void __thiscall CvGame::doControl(enum ControlTypes)" (?doControl@CvGame@@QAEXW4ControlTypes@@@Z) referenced in function "public: virtual void __thiscall CvDLLButtonPopup::OnOkClicked(class CvPopup *,class PopupReturn *,class CvPopupInfo &)" (?OnOkClicked@CvDLLButtonPopup@@UAEXPAVCvPopup@@PAVPopupReturn@@AAVCvPopupInfo@@@Z)
1>CvDLLWidgetData.obj : error LNK2001: unresolved external symbol "public: void __thiscall CvGame::doControl(enum ControlTypes)" (?doControl@CvGame@@QAEXW4ControlTypes@@@Z)
1>CvDLLWidgetData.obj : error LNK2019: unresolved external symbol "public: void __thiscall CvGame::selectedCitiesGameNetMessage(int,int,int,int,bool,bool,bool,bool)" (?selectedCitiesGameNetMessage@CvGame@@QAEXHHHH_N000@Z) referenced in function "public: void __thiscall CvDLLWidgetData::doLiberateCity(void)" (?doLiberateCity@CvDLLWidgetData@@QAEXXZ)
1>CyGame.obj : error LNK2001: unresolved external symbol "public: void __thiscall CvGame::selectedCitiesGameNetMessage(int,int,int,int,bool,bool,bool,bool)" (?selectedCitiesGameNetMessage@CvGame@@QAEXHHHH_N000@Z)
1>CvDLLWidgetData.obj : error LNK2019: unresolved external symbol "public: void __thiscall CvGame::handleAction(int)" (?handleAction@CvGame@@QAEXH@Z) referenced in function "public: void __thiscall CvDLLWidgetData::doAction(struct CvWidgetDataStruct &)" (?doAction@CvDLLWidgetData@@QAEXAAUCvWidgetDataStruct@@@Z)
1>CvGameTextMgr.obj : error LNK2019: unresolved external symbol "public: void __thiscall CvGame::getPlotUnits(class CvPlot const *,class std::vector<class CvUnit *,class std::allocator<class CvUnit *> > &)" (?getPlotUnits@CvGame@@QAEXPBVCvPlot@@AAV?$vector@PAVCvUnit@@V?$allocator@PAVCvUnit@@@std@@@std@@@Z) referenced in function "public: void __thiscall CvGameTextMgr::setPlotListHelp(class CvWStringBuffer &,class CvPlot *,bool,bool)" (?setPlotListHelp@CvGameTextMgr@@QAEXAAVCvWStringBuffer@@PAVCvPlot@@_N2@Z)
1>CvPlayer.obj : error LNK2019: unresolved external symbol "public: void __thiscall CvGame::updateColoredPlots(void)" (?updateColoredPlots@CvGame@@QAEXXZ) referenced in function "public: void __thiscall CvPlayer::doAdvancedStartAction(enum AdvancedStartActionTypes,int,int,int,bool)" (?doAdvancedStartAction@CvPlayer@@QAEXW4AdvancedStartActionTypes@@HHH_N@Z)
1>CvUnit.obj : error LNK2019: unresolved external symbol "public: void __thiscall CvGame::updateSelectionList(void)" (?updateSelectionList@CvGame@@QAEXXZ) referenced in function "public: void __thiscall CvUnit::kill(bool,enum PlayerTypes)" (?kill@CvUnit@@QAEX_NW4PlayerTypes@@@Z)
1>CyGame.obj : error LNK2019: unresolved external symbol "public: void __thiscall CvGame::cycleCities(bool,bool)" (?cycleCities@CvGame@@QAEX_N0@Z) referenced in function "public: void __thiscall CyGame::cycleCities(bool,bool)" (?cycleCities@CyGame@@QAEX_N0@Z)
1>CyGame.obj : error LNK2019: unresolved external symbol "public: void __thiscall CvGame::cycleSelectionGroups(bool,bool,bool)" (?cycleSelectionGroups@CvGame@@QAEX_N00@Z) referenced in function "public: void __thiscall CyGame::cycleSelectionGroups(bool,bool,bool)" (?cycleSelectionGroups@CyGame@@QAEX_N00@Z)
1>CyGame.obj : error LNK2019: unresolved external symbol "public: bool __thiscall CvGame::cyclePlotUnits(class CvPlot *,bool,bool,int)" (?cyclePlotUnits@CvGame@@QAE_NPAVCvPlot@@_N1H@Z) referenced in function "public: bool __thiscall CyGame::cyclePlotUnits(class CyPlot *,bool,bool,int)" (?cyclePlotUnits@CyGame@@QAE_NPAVCyPlot@@_N1H@Z)
1>CyGame.obj : error LNK2019: unresolved external symbol "public: void __thiscall CvGame::selectionListMove(class CvPlot *,bool,bool,bool)" (?selectionListMove@CvGame@@QAEXPAVCvPlot@@_N11@Z) referenced in function "public: void __thiscall CyGame::selectionListMove(class CyPlot *,bool,bool,bool)" (?selectionListMove@CyGame@@QAEXPAVCyPlot@@_N11@Z)
1>Final_Release/CvGameCoreDLL.dll : fatal error LNK1120: 12 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://d:\civ 4\Copie de CvGameCoreDLLAoC\CvGameCoreDLL\Final_Release\BuildLog.htm"
1>CvGameCoreDLL - 19 error(s), 0 warning(s)
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========

Could anybody help please?
 
Are you compiling a modded SDK ? Because - it said something about "AoC"...? If so are you sure you are using the correct makefile ? Because it looks like some intermediate targets might be missing (hence some files would not be compiled and missing when linking).

A first step should allways be to compile a un-modified SDK, so you can be sure nothing is broken in your tools.
Then you can go on compiling actual mods, but you need to pay attention to be using the correct makefile/settings/targets for these - If the mod added new source files these need to be accounted for in the makefile - the mods team probably can tell you mere.
 
Hi again,
It starts compiling fine, but this time, I have this message:
Code:
1>NMAKE : fatal error U1073: don't know how to make 'CyPlayerInterface2.cpp'
1>Stop.
1>Project : error PRJ0019: A tool returned an error code from "Performing Makefile project actions"
1>Build log was saved at "file://d:\civ 4\Civ4_SDK_source\CvGameCoreDLL_v161\CvGameCoreDLL\Final_Release\BuildLog.htm"
1>CvGameCoreDLL - 2 error(s), 0 warning(s)
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
I am using makefile for BTS, and CvGameCoreDLL V1.61...
Maybe I should use the basic makefile ?
If anybody could help ?
 
Version 1.61 is Vanilla isn't it ? Then the vanilla makefile - the right version too - from somewhere early in the thread would be in order.

Edit: if you have BTS, the latest BTS SDK code is in Where you installed Civ\Beyond the Sword\CvGameCoreDLL\ folder. If your game is fully patched it will be BTS 3.17 and can be compiled with the latest makefile in the thread.
 
You can actually run BTS from within Visual Studio and load the mod automatically.

Works great Kali thanks for the tip. :goodjob:

Got a question again. The way I set up my debugging situation is that I have to manually copy across the compiled debug DLL from the project folder into the /mod/assets/ directory via a copy and paste routine and then start up a debug session thanks to Kali's simplifications.

Is there a way to automatically copy across the DLL from the project to the mod directory after it has been compiled and linked? Something you could put into the makefile for example or something you tell VC++2008 to do?

Cheers and thanks.
 
@glider1

You can do it. If you look into the makefile at the Final_Release target you will find that it depends on several targets one of them is responsible for building the DLL.

Code:
Final_Release: depend_Final_Release Final_Release_DIRS Final_Release-before $(Final_Release_BIN) Final_Release-after

For example the Final_Release_DIRS in the above creates the output directory if it is not there:

Code:
Final_Release_DIRS:
	-@if not exist "Final_Release\." mkdir "Final_Release"

The Final_Release-after target is found near the file beginning and is currently empty you can add to it the following

Code:
Final_Release-after:
     -@if exist "Final_Release\CvGameCoreDLL.dll" copy "Final_Release\CvGameCoreDLL.dll" "Full path of where the dll ends-up"
 
Sticking my nose back in, I have a rare day all to myself - am I to understand that we actually have debugging figured out using VS 2005 or VS 2008?
 
We had it figured out on VS2005 Express a few pages back actually :D The updated instructions are in my signature.
I don't have VS 2008, and there seemed to be trouble getting the 2008 debugger to attach. It looks like Kalimakus and Glider figured it out as well now.
 
Nice work. I finally grabbed a copy of VS .NET 2003 which makes life easier. Now to find the time to get back into modding...
 
@Refar and Chaz
Yep thanks to all involved VS2008 debug's under Vista x64 no drama's and makes no difference to XP except for having to run VS as an "administrator" and that Vista uses more RAM....but to compensate the swapfile system seems more efficient and it is a very stable operating system. I can "just" get away with a 2GIG RAM machine for CIV development running CIV, VS and Opera simultaneously without frustration.
Cheers.
 
2008 works beautifully. Basically followed exactly what is in Refar's PDF for setting it up too. It is SO nice using this instead of Codeblocks too, especially now that I have the Makefile modified to copy my recent compilation directly to my SVN repository and to my playtesting directory :) Can also launch the debug version of the game directly and have it auto-attach to catch those annoying XML loading bugs.
 
Since I was the one asking the question about auto-attaching in the first place I should finally say thank you for the answer Kalimakhus. It's great to have a community like the one here on civfanatics.

Totally agree. Also, having used both VC2005 and VC2008, if anyone is running 2005, stick with it. I cannot find a single reason that says 2008 is better. I could be wrong on some detail.

Cheers.
 
I agree that if you already have VS2005 express there is no need to get the 2008 version. However I recommend VS2008 for anyone who doesn't have VS2005. The only advantage is that 2008 comes bundled with all the needed PSDK files. It will install the ones compatible with your system. Downloading the PSDK on its own is quite painful if your internet connection is not so good. Also if you have Vista or a 64bit system you may find the download options confusing.
 
@Kali
Good point. Vista compiled as 64 bit or 32 bit took me a while to understand the differences when I first got the machine.

Yesterday I began to edit Python and XML in VC2008 as well. In 2008 XML is colour highlighted not sure about 2005. All the bookmarking and search facilities work, and the environment remembers all loaded files and positions. It's starting to become a one stop shop.
Cheers.
 
I get all this goo when trying to build the debug dll using an unmodified copy of the Warlords SDK. The Final_Release dll builds just fine.

I've tried various makefiles, including jdog5000's warlords file:
http://forums.civfanatics.com/downloads.php?do=file&id=10018

For directions I've followed (except Warlords instead of BtS) Refar's pdf directions:
http://forums.civfanatics.com/showthread.php?p=7694164#post7694164

Any ideas what I'm doing wrong??

Spoiler :
1> "C:/Program Files/Microsoft Visual C++ Toolkit 2003/bin/link.exe" /dll /nologo /LIBPATH:python24/libs /LIBPATH:boost-1.32.0/libs/ /LIBPATH:"C:/Program Files/Microsoft Visual C++ Toolkit 2003/lib" /LIBPATH:"C:/Program Files/Microsoft Platform SDK for Windows Server 2003 R2/Lib" /out:Debug/CvGameCoreDLL_DEBUG.dll boost_python-vc71-mt-gd-1_32.lib winmm.lib Debug/CvArea.obj Debug/CvArtFileMgr.obj Debug/CvCity.obj Debug/CvCityAI.obj Debug/CvDLLButtonPopup.obj Debug/CvDLLEntity.obj Debug/CvDLLPython.obj Debug/CvDLLWidgetData.obj Debug/CvDeal.obj Debug/CvDiploParameters.obj Debug/CvFractal.obj Debug/CvGame.obj Debug/CvGameAI.obj Debug/CvGameCoreDLL.obj Debug/CvGameCoreUtils.obj Debug/CvGameTextMgr.obj Debug/CvGlobals.obj Debug/CvHallOfFameInfo.obj Debug/CvInfoWater.obj Debug/CvInfos.obj Debug/CvInitCore.obj Debug/CvMap.obj Debug/CvMapGenerator.obj Debug/CvPlayer.obj Debug/CvPlayerAI.obj Debug/CvPlot.obj Debug/CvPlotGroup.obj Debug/CvPopupInfo.obj Debug/CvPopupReturn.obj Debug/CvRandom.obj Debug/CvReplayInfo.obj Debug/CvReplayMessage.obj Debug/CvSelectionGroup.obj Debug/CvSelectionGroupAI.obj Debug/CvStructs.obj Debug/CvTalkingHeadMessage.obj Debug/CvTeam.obj Debug/CvTeamAI.obj Debug/CvUnit.obj Debug/CvUnitAI.obj Debug/CvXMLLoadUtility.obj Debug/CvXMLLoadUtilityGet.obj Debug/CvXMLLoadUtilityInit.obj Debug/CvXMLLoadUtilitySet.obj Debug/CyArea.obj Debug/CyAreaInterface.obj Debug/CyArgsList.obj Debug/CyArtFileMgr.obj Debug/CyArtFileMgrInterface.obj Debug/CyCity.obj Debug/CyCityInterface1.obj Debug/CyDeal.obj Debug/CyEnumsInterface.obj Debug/CyGame.obj Debug/CyGameCoreUtils.obj Debug/CyGameCoreUtilsInterface.obj Debug/CyGameInterface.obj Debug/CyGameTextMgr.obj Debug/CyGameTextMgrInterface.obj Debug/CyGlobalContext.obj Debug/CyGlobalContextInterface1.obj Debug/CyGlobalContextInterface2.obj Debug/CyGlobalContextInterface3.obj Debug/CyGlobalContextInterface4.obj Debug/CyHallOfFameInfo.obj Debug/CyHallOfFameInterface.obj Debug/CyInfoInterface1.obj Debug/CyInfoInterface2.obj Debug/CyInfoInterface3.obj Debug/CyMap.obj Debug/CyMapGenerator.obj Debug/CyMapGeneratorInterface.obj Debug/CyMapInterface.obj Debug/CyPlayer.obj Debug/CyPlayerInterface1.obj Debug/CyPlot.obj Debug/CyPlotInterface1.obj Debug/CyRandomInterface.obj Debug/CyReplayInfo.obj Debug/CySelectionGroup.obj Debug/CySelectionGroupInterface.obj Debug/CyStructsInterface1.obj Debug/CyTeam.obj Debug/CyTeamInterface.obj Debug/CyUnit.obj Debug/CyUnitInterface1.obj Debug/FAssert.obj Debug/FDialogTemplate.obj Debug/_precompile.obj /debug /pdb:Debug\CvGameCoreDLL_DEBUG.pdb
1> Creating library Debug/CvGameCoreDLL_DEBUG.lib and object Debug/CvGameCoreDLL_DEBUG.exp
1>CvDLLWidgetData.obj : error LNK2019: unresolved external symbol __imp__GetKeyState@4 referenced in function "public: void __thiscall CvDLLWidgetData::doResearch(struct CvWidgetDataStruct &)" (?doResearch@CvDLLWidgetData@@QAEXAAUCvWidgetDataStruct@@@Z)
1>FAssert.obj : error LNK2019: unresolved external symbol __imp__EndDialog@8 referenced in function "int __stdcall `anonymous namespace'::AssertDlgProc(struct HWND__ *,unsigned int,unsigned int,long)" (?AssertDlgProc@?A0x3e4c3903@@YGHPAUHWND__@@IIJ@Z)
1>FAssert.obj : error LNK2019: unresolved external symbol __imp__SetFocus@4 referenced in function "int __stdcall `anonymous namespace'::AssertDlgProc(struct HWND__ *,unsigned int,unsigned int,long)" (?AssertDlgProc@?A0x3e4c3903@@YGHPAUHWND__@@IIJ@Z)
1>FAssert.obj : error LNK2019: unresolved external symbol __imp__GetDlgItem@8 referenced in function "int __stdcall `anonymous namespace'::AssertDlgProc(struct HWND__ *,unsigned int,unsigned int,long)" (?AssertDlgProc@?A0x3e4c3903@@YGHPAUHWND__@@IIJ@Z)
1>FAssert.obj : error LNK2019: unresolved external symbol __imp__SetWindowTextA@8 referenced in function "int __stdcall `anonymous namespace'::AssertDlgProc(struct HWND__ *,unsigned int,unsigned int,long)" (?AssertDlgProc@?A0x3e4c3903@@YGHPAUHWND__@@IIJ@Z)
1>FAssert.obj : error LNK2019: unresolved external symbol __imp__DialogBoxIndirectParamA@20 referenced in function "unsigned long __cdecl `anonymous namespace'::DisplayAssertDialog(void)" (?DisplayAssertDialog@?A0x3e4c3903@@YAKXZ)
1>Debug/CvGameCoreDLL_DEBUG.dll : fatal error LNK1120: 6 unresolved externals
1>NMAKE : fatal error U1077: '"C:/Program Files/Microsoft Visual C++ Toolkit 2003/bin/link.exe"' : return code '0x460'
 
Top Bottom