Problems wrapping FreeImage with SWIG on win32

Riccardo rtrocca at
Mon Mar 15 14:30:40 CET 2004

Hello, I'm trying to wrap FreeImage ( through SWIG in
Python on Win32. I'm using VC6sp5.
I've tried both using the static library and the dynamic one, having
the same kind of problems: missing symbols.
I describe you the sequence:
I create a swig file like this one:

%module freeimage
#include "FreeImage.h"
const char *FreeImage_GetVersion();
const char *FreeImage_GetCopyrightMessage();

then I create the source file with:

swig -python -c++ -o pyFreeImage.cpp FreeImage.i

The file is:

description="wrapper to FreeImage",
ext_modules=[Extension("_freeimage", ["pyFreeImage.cpp"],

So far so good.
When I launch the build the file compiles well but I've problems
during the link phase:

C:\Programmi\Microsoft Visual Studio\VC98\BIN\link.exe /DLL /nologo
/INCREMENTAL:NO /LIBPATH:C:\Python23\libs /LIBPATH:C:\Python23\PCBuild
FreeImage.lib /EXPORT:init_freeimage
Creating library build\temp.win32-2.3\Release\_freeimage.lib and
object build\temp.win32-2.3\Release\_freeimage.exp
pyFreeImage.obj : error LNK2001: unresolved external symbol
pyFreeImage.obj : error LNK2001: unresolved external symbol
build\lib.win32-2.3\_freeimage.pyd : fatal error LNK1120: 2 unresolved
error: command '"C:\Programmi\Microsoft Visual
Studio\VC98\BIN\link.exe"' failed with exit status 1120

Given that VC finds the library (I use it in an application of mine
and it compiles well), and that the lib is the latest one,
pre-compiled, as found on,
what am I missing?

THanks for the help.


More information about the Python-list mailing list