Most precompiled Windows binaries are made with the MSYS+gcc toolchain. It uses MSVCRT runtime, which is incompatible with Visual C++ 2005/2008.
So, how to go about and compile Cairo 1.6.4 (or later) for Visual C++ only. Including dependencies (png,zlib,pixman).
Best Solution
Here are instructions for building Cairo/Cairomm with Visual C++.
Required:
To use VC++ command line tools, a batch file 'vcvars32.bat' needs to be run.
ZLib
Download (and extract) zlib123.zip from http://www.zlib.net/
libpng
Download (and extract) lpng1231.zip from http://www.libpng.org/pub/png/libpng.html
The VC++ 9.0 compiler gives loads of "this might be unsafe" warnings. Ignore them; this is MS security panic (the code is good).
Pixman
Pixman is part of Cairo, but a separate download.
Download (and extract) pixman-0.12.0.tar.gz from http://www.cairographics.org/releases/
Use MSYS to untar via 'tar -xvzf pixman*.tar.gz'
Both Pixman and Cairo have Makefiles for Visual C++ command line compiler (cl), but they use Gnu makefile and Unix-like tools (sed etc.). This means we have to run the make from within MSYS.
Open a command prompt with VC++ command line tools enabled (try 'cl /?'). Turn that command prompt into an MSYS prompt by 'C:\MSYS\1.0\MSYS.BAT'.
DO NOT use the MSYS icon, because then your prompt will now know of VC++. You cannot run .bat files from MSYS.
Try that VC++ tools work from here: 'cl -?'
Try that Gnu make also works: 'make -v'.
Cool.
This defaults to MMX and SSE2 optimizations, which require a newish x86 processor (Pentium 4 or Pentium M or above: http://fi.wikipedia.org/wiki/SSE2 )
There's quite some warnings but it seems to succeed.
Stay in the VC++ spiced MSYS prompt for also Cairo to compile.
cairo
Download (and extract) cairo-1.6.4.tar.gz from http://www.cairographics.org/releases/
The Makefile.win32 here is almost good, but has the Pixman path hardwired.
Use the modified 'Makefile-cairo.win32':
(Write everything on one line, ignoring the backslashes)
It says "no rule to make 'src/cairo-features.h'. Use the manually prepared one (in Cairo > 1.6.4 there may be a 'src/cairo-features-win32.h' that you can simply rename):
Retry the make command (arrow up remembers it).
cairomm (C++ API)
Download (and extract) cairomm-1.6.4.tar.gz from http://www.cairographics.org/releases/
There is a Visual C++ 2005 Project that we can use (via open & upgrade) for 2008.
Changes that need to be done:
Change active configuration to "Release"
Cairomm-1.0 properties (with right click menu)
Right click on 'cairomm-1.0' and 'build'. There are some warnings.