Skip to content

Building with Visual Studio 2010 (Express Included)

Albert Huang edited this page Jan 11, 2016 · 2 revisions

Introduction

Building with Visual Studio 2010 isn't too painful! However, the environment must be set up correctly in order for SPASM-ng to successfully build.

This guide particularly focuses on setting up a working build environment for Visual C++ 2010 Express, though it is still very helpful for those who are trying to set it up correctly (e.g. SP1 and Windows SDK).

This guide is basically a summary of this guide, which is extremely helpful with setting up VS2010! (Seriously, this is a life-saver! Thanks to the author over there!)

Oh, and can't forget this guide as well for navigating the crazy world of Visual Studio... again, another great guide!

Goals

  • Visual Studio 2010 SP1
  • Windows SDK 7.1 (if using Express and attempting to build x64 binaries)
  • Windows Driver Kit 7.1 for ATL headers (if using Express)

Steps

  1. Install your favorite edition Visual Studio 2010. Reboot if necessary.
  2. Uninstall any Visual C++ 2010 runtime newer than 10.0.30319.
  3. If you are using VS2010 Express, and want to build x64 binaries, install Windows SDK v7.1! Otherwise, skip!
    • Note that you don't have to have a x64 OS/CPU to build - the SDK has cross-compilers to let you build from any platform.
    • You might as well install this anyways - if you don't install it at this step, you won't be able to install in the future - without uninstalling VS2010 at least!
  4. Install VS2010 SP1:
    • DO NOT RUN ANY WINDOWS UPDATE. You do not want to get SP1 from there.
    • Instead, download and mount Microsoft's official VS2010 SP1 ISO from here. Install SP1 from the ISO.
  5. If you installed Windows SDK v7.1:
    • Download and install the here to get your x64 compiler back!
    • Microsoft's SP1 upgrade tool happily deletes your Windows v7.1 SDK compilers (especially x64!) for some reason, so you MUST install the hotfix above to get them back!

Steps to enable COM support for VS2010 Express

  1. Download Windows Driver Kit v7.1.0.
  2. Add the following paths to the project:
    • Includes: C:\WinDDK\7600.16385.1\inc\atl71
    • Libraries: C:\WinDDK\7600.16385.1\lib\ATL\i386
  3. Enable COM code by defining this macro for the entire project: SPASM_NG_ENABLE_COM
  4. That's it - go and build!
    • There may be some interesting warnings, but these are 100% harmless:
      • Macro redefinition warnings - this is a Microsoft bug with the Visual C++ 2010 headers colliding with the Windows SDK headers. (See: here, here, and here with the actual bug report to Microsoft - fix applied to VS2012.)
        • This should now be fixed! (Commit f73aa07 is the workaround for this bug.) No warnings should appear anymore.
        • Example: c:\program files (x86)\microsoft visual studio 10.0\vc\include\stdint.h(72): warning C4005: 'INT8_MIN' : macro redefinition c:\program files\microsoft sdks\windows\v7.1\include\intsafe.h(144) : see previous definition of 'INT8_MIN'
      • Linker warnings - this is yet another Microsoft bug - again, it involves the Windows SDK v7.1 since this is our source for ATL headers. (See: here, here, and here with an explanation of what's happening to cause these warnings.)
        • Example: utils.obj : warning LNK4254: section 'ATL' (50000040) merged into '.rdata' (40000040) with different attributes atlsd.lib(atlfuncs.obj) : warning LNK4254: section 'ATL' (50000040) merged into '.rdata' (40000040) with different attributes