December 26, 2010

Compiling DarkGDK and Visual Studio 2010

If you've tried using DarkGDK, the DirectX August 2007 SDK, and Visual Studio 2010 together, chances are that it has led to nothing but failure.

The biggest indication that you are having problems is when you try the simplest possible DarkGDK application...

#include "DarkGDK.h"

void DarkGDK(void)
{
dbSyncOn();
dbSyncRate(60);
while (LoopGDK())
{
dbSync();
}
return;
}


...you get "error C2061: syntax error : identifier '__RPC__out_xcount_part'" when compiling. Frustrating to say the least.

Solution? First, make a copy of the lib folder from the August 2007 DirectX SDK, uninstall the August 2007 SDK and install the February 2010 DirectX SDK.

Second, in your DirectX SDK's lib folder, make a copy of dxerr.lib and name it dxerr9.lib.

Third, open C:\Program Files\Microsoft SDKs\Windows\v7.1\Samples\multimedia\directshow\baseclasses\baseclasses.sln and compile it targeting Release_MBCS so you can get strmbase.lib and strmbasd.lib. (No license to redistribute...sorry.)

Fourth, make sure you are using the October 2010 version of the DarkGDK libraries.

Fifth, rename multiplayer.lib in the DarkGDK lib folders to multiplayer_old.lib.

Finally, download this dummy multiplayer.lib to replace it. This will disable the built-in DirectPlay support, but you'll be able to compile, so it's worth it. (Dummy library built per the instructions in this thread.)

Once all is done, you'll be able to get DarkGDK to work just fine for everything except multiplayer.

5 comments:

Steve said...

Hi Michael,
I really appreciate this post, I would like to get DarkGDK working with my Visual Studio 2010 install.

I get the same error you describe here.
However, I am stuck - I don't understand what you mean when you say, "compile it targeting Release_MBCS so you can get strmbase.lib and strmbasd.lib".

Can you explain this to me, how I would do this please? I would really appreciate it.

Hope to hear back from you.
-Steve

Michael Russell said...

Trashcan, if you have the Build toolbar on Visual Studio, you should have an area with a dropdown that has things like "Debug" and "Release_MBCS" in it. Use that dropdown.

Sam Snyder said...

You tell us to copy SDK 2007's lib folder, but what is the purpose? You don't say whether to copy it back or not.

Also, (C:\Program Files\Microsoft SDKs\Windows\v7.1) is non-existent to me, I only have v7.0A.

Any ideas?

Michael Russell said...

Sam,

There may be times when you still need those old lib files later. It's a precautionary step, nothing more.

Alfredo Espinoza Rhoton said...

For the people that might have trouble getting the base class libraries, you can get them from the google code svn repository in: http://code.google.com/p/darkbasicpro/source/browse/trunk/+darkbasicpro+--username+LeeBamberTGC/Dark+Basic+Pro+SDK/Shared/BaseClasses/STRMBASE.lib?r=25.

I had no need to use the Feb 2010 DirectX SDK or the multiplayer lib, just added the Aug 2007 SDK includes and libs and added the Windows SDK 7.1 directory as an additional include. Have not tried multiplayer, but simple programs with sprites compile and run ok.