en fr

es pl

sv de
direct download download direct download

howto/en/compile under visual

From Wormux

Don't forget to check out compilation under mingw if this page doesn't get updated and you therefore encounter a problem.

Contents

Base system

This guide only supports Visual Studio 2005, either Professional or Free version. The later requires installing the platform SDK, though. Another subtle difference is that the built binaries may now require the Visual Studio Runtime (aka msvcrt80.dll and such), so users may have to install the runtime for it. Be aware that if you compile in debug mode some libraries, the resulting binary won't even launch because of unsatisfied dependencies installed with VS2005!

One package to bind most

Here is the set of libraries (except glib/xml++ stuff) I use: SDK

glibmm and friends

This subsection historically tried to describe compilation of many packages. Nowadays, SDK packages are quite well done, and as we can't but base many things (including installer script) on the location and names of dlls, the parts related to (nowadays unnecessary) compilation were removed. One can get SDK for gtk+ at [1] that contains the following packages of interest to us:

  • libxml2 (2.6.32)
  • libjpeg
  • libpng

SDL

Other common SDL libs

In order to factorize the dependencies between a MSVC and a mingw build, the Visual Studio 2005 (aka VC8) packages were used. Have a look at [2], where you should pick the Development Libraries for such libraries as:

  • SDL_ttf
  • SDL_net
  • SDL_mixer

SDL_image

This one has may cause some trouble. It may force to ship/have duplicated dlls, so it may be better to rebuild it and not have duplicated dlls. In addition, the jpeg boolean type might be wrong and adding such code may help:

#define HAVE_BOOLEAN /* Avoid libjpeg headers to define their own boolean type */
#define boolean unsigned char /* Change according to the dll you have */

SDL_gfx

  • Get the latest source from [3]; you'll probably need a archive manager able to deal with .tar and .gz formats, like GPL program 7zip
  • Unpack Other Builds/VisualC7.zip and go in the newly created VisualC folder
  • Open the vcproj that should get converted to the new VC8 format by the usual wizard, and select the Release target
  • Change the project properties to "Static library (.lib)" in "Configuration Properties" -> "General" -> "Project Defaults" -> "Configuration Type"
  • Change the "Code Generation" "Runtime library" to "Multi-threaded DLL (/MD)".
  • Also change the Project's "Preprocessor Definitions" to:
WIN32;_WINDOWS
  • Remove all .c and .h files, and readd them from their correct location
  • Edit all headers and replace the blurb about DLLINTERFACE (there should be 5 out of 6 headers to modify) from the macro by this single line:
#define DLLINTERFACE
  • Edit SDL_gfxPrimitives.c and place somewhere at the top:
  1. define lrint(x) (floor(x+(x>0) ? 0.5 : -0.5))
  • As for SDL_image, copy produced files to their correct places

libcurl

  • Get the source package from the official libcurl download page
  • Go to the lib folder, open and convert the vcproj file
  • Compile and copy curllib.lib to some place accessible to VC8 linker (for instance alongside SDL.lib). Remember to append 'd' to the Debug library name. The built library is probably a static library.
  • Your library may or may not be a static library, so you may have to remove CURL_STATICLIB from the Project Preprocessor Definitions.