Stuck in my build process using VS 2010

    This site uses cookies. By continuing to browse this site, you are agreeing to our Cookie Policy.

    • Stuck in my build process using VS 2010

      This thread is to provide a careful, complete description of the Steps I have followed on June 4th and 5th, 2011 in order to get the Game Coding Complete textbook code to compile. My name is Richard McKenna (McKillaGorilla is my old trash-talking StarCraft name) and I teach 2 game programming courses at Stony Brook University (see cs.stonybrook.edu/~games). I am evaluating the GCC textbook and like the written material in the book itself, and so would like to similarly evaluate the code base, but currently have a problem that has not yet been resolved.

      Forgive me for the length of my post and the fact that I include steps that should seem obvious, I'm just being thorough and outlining in careful detail any steps my students may need to follow in case I use the book. I have more than 30 steps, and would prefer not to have more than 30 emails from each student along the way trying to figure out how to get it working, plus I'd prefer for them to spend their time on the code and data structures and algorithms used rather than Visual Studio quirks.

      Although if I can get this working and like the library I may just make a VS2010 project from scratch and develop my own stable build process. But that's getting ahead of myself. I have not yet committed to that sort of time investment. Of course I'm not against someone else providing that for me (hint hint, nudge nudge, know what I mean?).

      Anyway, I have tried to combine the instructions as provided in the README file that comes with the code as well as the various posts on the message board. Specifically, there were 3 from Mike (the author) summarizing the steps for compilation in VS 2010. Note that step 31 down at the bottom shows where I am stuck, but the rest may provide some indication as to why this is so. Any help would be appreciated, Here are the steps I've followed. Enjoy!

      1) Got GameCode3 project using TortoiseSVN using SVN Checkout gamecode3.googlecode.com/svn/trunk/ in Windows Explorer. Put full code base into my "GCC_VS2010" directory

      2) Downloaded 3rdParty-2010.zip from code.google.com/p/gamecode3/do…il?name=3rdParty-2010.zip link provided by code.google.com/p/gamecode3/downloads/list

      3) Unzipped 3rdParty-2010.zip to GameCode3/Source directory. While it was unzipping, I checked my fantasy baseball team and then took a nap. After the nap, the unzip process was almost finished. Once done, the contents of GameCode3/Source were:
      -boost_1_45_0
      -bullet-2.73
      -LuaPlus
      -oggvorbis-win32sdk-1.0

      4) Went to GameCode3/Source directory and double
      clicked on GameCode3_2005 Visual Studio Solution file,
      which opens it in Visual Studio 2010. Obviously VS 2010
      must be installed for this to work, and no I'm not joking.

      5) Ran Visual Studio Conversion Wizard. Left selection as "Yes, create a backup before converting" and clicked "Next". I understand, this option doesn't matter, just being thorough. Clicked Finish and all 6 projects are converted without error:
      -DXUT10
      -Editor
      -EditorApp
      -GameCode3 (initially the Startup Project)
      -Lang
      -TeapotWars

      6) Downloaded and installed the latest and greatest DirectX SDK, the June2010 version. Installed in C://Program Files (x86)/Microsoft DirectX SDK (June 2010)

      7) Added property sheet in VS 2010. Here's how:
      -from menu, selected View->Property Manager. This opened the Property Manager
      -selected all the Projects that use DirectX (DXUT, Editor, GameCode3, and TeapotWars) using CTRL-Left Mouse Button and clicked on Add New Property Sheet
      -named new property sheet WinDX and saved it to the Source Directory
      -it appeared in all 4 projects at the top in both Debug and Release, so DXUT and GameCode3 listed the following 5 in this order:
      -WinDX
      -Upgrade from VC 7.1
      -Microsoft.Cpp.Win32.user
      -Unicode Support
      -Core Windows Libraries
      The Editor project also had Windows Dynamic Link Library sheet Teapot Wars also had an Application sheet

      8) Opened my WinDX Property Sheet. To this sheet I only added 2 things, under VC++ Directories:
      -Include Directories, I added the DirectX\Include directory
      -Library Directories, I added the DirectX\Lib\x86
      Note that obviously "DirectX" is just short for the June 2010 directory where it is installed. I now saved my WinDX Property Sheet settings and closed the Property Manager. Note that I did not have to reorder any property sheets.

      9) Searched for "atltypes.h" in VS 2010 solution and found it referenced twice inside GameCodeStd.h . Note this is a potential source of confusion because on the message board it was listed as alttypes.h, which will not be found.

      10) Saved gcctypes.h to Source directory, the same as GameCodeStd.h, as posted on message board. Then in VS2010, right-clicked on GameCode3 project->Add->Existing Item and selected the gcctypes.h file. Then commented out both #include <atltypes.h> lines and added #include "gcctypes.h" in their place. The compiler was happy with this.

      11) Went to String.cpp in Dumbstuff directory and changed both occurrences of "std::string.npos" to "std::string::npos"

      12) Had a very strange moment where I went to DXUT.h to change <dxerr9.h> to <dxerr.h> and found
      that it was already changed. I don't recall doing that today. I thought I had done it a day or so ago in a previous attempt to get this working, but perhaps I did it without thinking. Looking at the SVN data, the last commit revision was April 2009, so I must have done it. Anyway, it should be correct now.

      13) Right Clicked on the DXUT project and selected "Build". This succeeded. Note that I did not change the Output Directory for this project, and so left it as ..\..\Libs, which is where it placed the DXUT10d Object File Library.

      14) Right Clicked on the Editor project and selected "Build" and AHA! Now I got the dxerr9.h error inside the Source\DX10\dxstdafx.h file that I was expecting before. This is a bit tricky because when I searched the VS2010 solution for "dxerr9.h" it does not come up because it is an "External Dependency" I presume. Anyway, I now changed "dxerr9.h" to "dxerr.h" and that error went away. The build failed, however, due to 4 compiler errors inside GameCodeStd.h, which is actually inside the GameCode3 project and is included by Editor.h. The compiler flagged:

      #include <boost\config.hpp>
      #include <boost\shared_ptr.hpp>
      #include <boost\utility.hpp>

      using boost::shared_ptr;

      The error message read "fatal error C1083: Cannot open include file: 'boost\config.hpp': No such file or directory". Here is where my previous attempts really started to go haywire.

      15) In looking at the Editor project properties, I saw that for "Additional Include Directories", it lists "$(SolutionDir)3rdParty\boost_1_37_0", which is the wrong version of boost. The 3rdParty-2010.zip file came with version 45. So, I simply changed the 37 to 45. I did the same for the GameCode3 and TeapotWars project properties pages and when I did I saw the "Additional Include Directories" is listed as "$(SolutionDir)\3rdParty\boost_1_37_0", which is slightly different. It had a "\" after $(SolutionDIr). This was true of all similar listings, which was not true for the Editor project. Having used Visual studio for more than a decade my mind is a jumbled mess of all the various versions and their conventions. I can't remember what it should be, but I assume there should be a slash and that it's not implied by $(SolutionDir). Plus, an extra slash wouldn't do any harm would it? It probably doesn't matter, but anyway, I went to the Editor project and added it for all the $(SolutionDir)\ references. I then did the same for the Teapot Wars project properties.

      16) Now I went back to the Editor project and tried to build it and I hit the motherload. When it builds, it flagged every reference to Lua and boost, and even some stuff inside of Lua and boost. We're talking a mile of compiler errors. The hope here is this can be resolved all at once and not one at a time.

      17) I started with the first one listed, "gamecode3\source\actors.h(128): error C2061: syntax error : identifier 'LuaObject'", which is one of many in that file. I've figured out that Lua uses the LuaPlus namespace, so I added "using LuaPlus::LuaObject;" after #include "LuaPlus/LuaObject.h" inside actors.h. I rebuild and that error is gone.

      18) Similar problems in source\scripting \LuaStateManager.h . It flagged all sorts of lua types, so I added:

      using LuaPlus::LuaStateOwner;
      using LuaPlus::LuaObject;

      after the other lua includes. This took care of those compiler errors.

      19) I'll skip the boost errors for now and just handle the lua stuff, so next up was source\scripting\scripteventlistener.cpp. I added:

      using LuaPlus::LuaFunction;
      using LuaPlus::LuaState;

      after the includes and resolved these errors.

      20) Next up was Events.h, to which I added "using LuaPlus::LuaState;"

      21) Next is AiEvents.h, to which I added:

      using LuaPlus::LuaObject;
      using LuaPlus::LuaState;

      22) Next is EventManager.h, to which I added "using LuaPlus::LuaState;"

      23) Next is PhysicsEventListener.h, to which I added "using LuaPlus::LuaState;"

      continued ...
      Richard McKenna
      Lecturer
      Computer Science Department
      Stony Brook University
    • ... continued ...

      ... continued

      24) It looks like all the lua errors were gone now, so that's good. Next I found another string problem similar to the one we resolved in String.cpp. This one was in source\editor\editorglobalfunctions.cpp. There I simply replaced std::string.npos with std::string::npos

      25) Ok, at this point, I only appeared to have boost errors, but this was a new and different category of problem, it seemed. There appeared to be conflicts in use. Here's where Mike has advised to change the macro named "V" to "VVV". This macro is defined inside DXUT.h . Apparently it's in conflct with a Boost template. So, I changed the relevant code block in dxut.h to:

      #if defined(DEBUG) || defined(_DEBUG)
      #ifndef VVV
      #define VVV(x) { hr = (x); if( FAILED(hr) ) { DXUTTrace( __FILE__, (DWORD)__LINE__, hr,

      L#x, true ); } }
      #endif
      #ifndef VVV_RETURN
      #define VVV_RETURN(x) { hr = (x); if( FAILED(hr) ) { return DXUTTrace( __FILE__, (DWORD)__LINE__,

      hr, L#x, true ); } }
      #endif
      #else
      #ifndef VVV
      #define VVV(x) { hr = (x); }
      #endif
      #ifndef VVV_RETURN
      #define VVV_RETURN(x) { hr = (x); if( FAILED(hr) ) { return hr; } }
      #endif
      #endif

      Notice that I also changed the VVV_RETURN just in case that had a conflict as well (not likely), but really more just for consistency.

      26) Now I had to change all the references to the V macro to VVV. So, I just searched for V( in the solution and one at a time made sure to change the proper ones to VVV( . These were found in DXUT.cpp, DXUTcamera.cpp, and SDKmesh.cpp. And V_RETURN in those as well as in SDKmisc.cpp . At this point I crossed my fingers and hope that none of the V( calls I just changed are supposed to be referencing the boost template. Being brand new to this code base, I had no idea, but assumed that since those 3 files are all in the DXUT project, that they use the DXUT macro.

      27) After the macro changes I now rebuilt the DXUT project and it succeeded. But, I then went back to trying to build the Editor project and all the same Boost errors were there as before. They all seemed to stem from a similar problem, and had a similar error message, like:
      ...source\3rdparty\boost_1_45_0\boost\thread\locks.hpp(85)' was not matched correctly

      28) I started thinking about how to correct this and decided to do a full install of the boost library, which took a shockingly long time. After it finally installed, I removed all references in my projects to the 3rdParty boost code (include directories) and instead made a new property sheet called WinBoost and added C://Program Files (x86)/boost/boost_1_46_1/boost as an include directory and C://Program Files (x86)/boost/boost_1_46_1/lib as a library directory. I added this page to the Editor, GameCode3, and TeapotWars projects. I then cleaned my entire solution and rebuilt the Editor project, which reverted back to a previous problem I've had, where it simply does not recognize boost. It specifically flags:

      #include <boost\config.hpp>
      #include <boost\shared_ptr.hpp>
      #include <boost\utility.hpp>

      using boost::shared_ptr;

      Saying "Cannot open include file: 'boost\config.hpp': No such file or directory"

      The thing is, I looked inside my newly installed boost library at the location I had the projects referencing, and I saw config.hpp right there in the boost directory that I specified as an include directory. Hmm, that shouldn't be. Then I thought about it and realized I included the boost directory, and then I'm referencing everything relative to a boost directory, i.e. <boost\..>, which
      doesn't make sense, because the boost directory I'm referencing doesn't have another boost directory inside. So, I changed my include directory to the boost_1_46_1 directory, so that I could reference boost specific stuff using <boost\..., and that took care of the previous error. config.hpp is now found but now we're back to the same problem as before as well as a new one.

      29) Now I had a bunch of errors related to boost's shared_ptr type. This was happening inside Editor.h, Editor.cpp, EditorGlobalFunctions.cpp, EditorGameView.cpp, Rescache2.h, CAudio.h, DirectSoundsAudio.h, and Network.h, I added the following declaration to all of these files:

      #include <boost\smart_ptr\shared_ptr.hpp> using boost::shared_ptr;

      30) Now I rebuilt and I see there was a shared_ptr conflict. I got a series of errors on the same code as before, but now it tells me things like:

      gamecode3\source\editor\editor.h(111): error C2872: 'shared_ptr' : ambiguous symbol
      could be ...\boost\boost_1_46_1\boost\smart_ptr\shared_ptr.hpp(169) : boost::shared_ptr'
      or ...\microsoft visual studio 10.0\vc\include\memory(1418) : std::tr1::shared_ptr'

      So which one am I supposed to be using? Honestly, it could be either one, but I assumed that boost is the favorite so I switched all uses in these files to:

      boost::shared_ptr

      This was a little funny, because inside many of these classes I do see direct references to "boost::static_pointer_cast" which leads me to wonder how this code ever compiled for anyone else.

      Keep in mind I have never used or seen the Game Coding Complete code before, I don't know where all the bodies are buried, I don't know what any of these types are, I just want to try and give it a whirl to see if I want to use it for my class or not. Making this change, made the compiler happy for these particular errors, but there are still the template/macro conflict ones.

      31) I now have again, 50 or so errors like:

      4>c:\program files (x86)\boost\boost_1_46_1\boost\thread\locks.hpp(85): error C2958: the left parenthesis '(' found at 'c:\program files (x86)\boost\boost_1_46_1\boost\thread\locks.hpp(85)' was not matched correctly
      4> c:\program files (x86)\boost\boost_1_46_1\boost\thread\locks.hpp(91) : see reference to class template instantiation 'boost::detail::has_member_lock<T,true>' being compiled
      4>c:\program files (x86)\boost\boost_1_46_1\boost\thread\locks.hpp(85): error C2988: unrecognizable

      template declaration/definition
      4>c:\program files (x86)\boost\boost_1_46_1\boost\thread\locks.hpp(85): error C2059: syntax error :

      '<end Parse>'
      4>c:\program files (x86)\boost\boost_1_46_1\boost\thread\locks.hpp(85): error C2238: unexpected

      token(s) preceding ';'

      All these errors are in referencing either line 85 or line 109 in locks.hpp. Lines 84/85 are:

      template<typename U,typename V>
      static true_type has_member(V (U::*)());

      And lines 108/109 are:

      template<typename U,typename V>
      static true_type has_member(V (U::*)());

      So, obviously both flagged lines are using "V", which I suspect somehow, some way, Visual Studio is confusing with our old V(x) MACRO. Note that I had changed the V macro to VVV in step 25. I'm not sure why it would still be lingering around, I have cleaned the Solutions numerous times since then.

      Why would the V macro still producing the conflict? Can I refresh it somehow? I've saved the file many times since then, but to no avail. I am now stuck. After days of trying to get this to work, I am out of ideas. I am tempted to change the 'V' reference inside the boost code and recompile it, but doing that would be like shooting a rabbit with an elephant gun and I don't own an elephant gun.

      Downloading and unzipping boost, and then downloading and installing boost, and correcting all the references, has made me wary of doing something so ambitious.

      32) Currently debating whether to keep going or find another textbook. I really do like the book, I feel it overlaps with much of the material covered in my course, and in examining the structure of the code (not the functionality yet), I think it would be a good choice, but am a bit frustrated with this build process. I have more than a decade of experience in C++ coding in visual Studio and a graduate degree in Computer Science and I am stuck. How do I think undergrad students fairly new to C++ will fair?

      If anyone can help me with careful instructions that don't involve recompiling boost, my wife and son will thank you.
      Richard McKenna
      Lecturer
      Computer Science Department
      Stony Brook University
    • RE: ... continued ...

      I think you were tantalizingly close before you reinstalled Boost - perhaps all that was needed is a complete recompile of the editor code.

      The error you are seeing is indeed exactly what changing the V(x) macro in DXUT was supposed to solve. My suggestion - change the V(x) macro again in DXUT to V1(x) or something, and hopefully that will get you back on track.

      You are very close to getting this to work - I promise. And of course, the kind of patience and diligence you are applying now is good practice for programming anything, anywhere.

      :)
      Mr.Mike
      Author, Programmer, Brewer, Patriot
    • RE: ... continued ...

      For any stragglers stumbling upon this post, I got TeapotWars to work, basically I built my own VS 2010 project from scratch and setup all the connections with my own compiled bullet, LuaPlus, ogg and vorbis. I'm using an installed Boost. Working on EditorApp now.
      Richard McKenna
      Lecturer
      Computer Science Department
      Stony Brook University
    • Stuck on Step 31

      Sorry for necro'ing this thread, but in my attempt to build Teapot Wars, I ran across every problem McKillaGorilla described except step 29. I ended up following you step by step and I have compiled boost 1.48 and linked it. But I'm still wondering how did you end up getting it to work?

      The post was edited 1 time, last by UnfoundedBros ().

    • RE: Stuck on Step 31

      You don't need boost with VS2010, it has all that stuff include.

      First comment out all the code in CriticalSection.h, then in GameCodeStd.h replace all that boost stuff with:

      #include <ppl.h>
      #include <concurrent_queue.h>
      #include <concrt.h>

      using std::shared_ptr;
      using Concurrency::concurrent_queue;
      typedef Concurrency::critical_section CriticalSection;
      typedef Concurrency::critical_section::scoped_lock ScopedCriticalSection;


      Then you'll need to build a few times and replace any "boost::" syntax with "std::", it took me about 20 mins.

      The only thing is the noncopyable struct, but you can just add a private copy and assignment declaration yourself, its only a couple of classes.