Contents |
First step is to make sure your Visual Studio system is up to date. As of this writing, we support the following versions:
You also need to install a version of the DirectX SDK, but there is no need for the very latest. So if you already have a version installed that will work just fine.
If you need the very latest Clanlib directly from our source control repository, read the compilation guide instead.
Otherwise and much easier, you can just use the precompiled versions we provide, these are always up-to-date on the latest release. Read on for a guide on using the precompiled libraries.
Download the ClanLib and the Dependency libraries: Visual Studio binaries
After you downloaded the binaries, exctract these files into a directory. Remember which one, because you need to enter that information in the next section. It will create a structure looking like this:
You will need to configure Visual Studio to look for the downloaded libraries.
Adding global includes to Visual Studio 2008
Adding global includes to Visual Studio 2010
Follow these steps to create a Visual Studio solution for a ClanLib application:



That should be it. If you've done everything correct, you can start coding your ClanLib application!
You could also check out the examples that comes with the distribution; they are a great resource to learn from. Since the precompiled packages does not include the examples, you will need to download the ClanLib source package. Download the ClanLib source package, extract it anywhere, and open the Examples.sln Visual Studio solution file.
The most common problems encountered with building ClanLib applications:
1. Problem: You get a lot of linker errors complaining about multiple definitions of functions like _exit or an error "cannot open file '*-static-mtdll-debug.lib' "
This is almost always caused by mixing runtime versions. Your project is most likely set to Multithreaded Debug DLL, while ClanLib expects it to be Multithreaded Debug. Fixed by going to the project settings of your project and set it to what ClanLib expects.
2. Problem: You get a lot of linker errors complaining about xran and similar.
This is probably caused by using libraries compiled with Visual Studio 2008 in a Visual Studio 2010 environment. Download the correct precompiled versions.
3. Problem: LINK : fatal error LNK1104: cannot open file 'zlib-static-mt-debug.lib'
Visual Studio cannot locate the ClanLib dependency libraries. Make sure you have setup the include and libs directories correctly as explained in the guide. If you only have files like zlib-x64-static-mt-debug.lib, make sure you compile your application in 64 bit and not 32 bit.