VC++ linking problem

Wolfgang Langner wl at flexis.de
Thu Jul 7 08:19:38 EDT 2005


Hello Jochen,

> I started embedding python into a 3D graphics App and I came
> across this linking problem.
> 
> 
> SO.lib(ScnGlobal.obj) : error LNK2001: unresolved external symbol
> __imp__Py_InitModule4TraceRefs
> SO.lib(ScnNode.obj) : error LNK2001: unresolved external symbol
> __imp___Py_RefTotal
> SO.lib(ScnLight.obj) : error LNK2001: unresolved external symbol
> __imp___Py_RefTotal
> 
> I am linking against python24.lib using VC++ 6.0. Before I got to this
> point it couldn't find python24_d.lib. After searching around
> for a while I came across a solution that included changing
> python24_d.lib to python24.lib in one of the header files. I hope that
> didn't have a negative effect. I would really appreciate
> some help....

Be careful, python 2.4 is build with VC++ 7.1.
Mixing this in your application which is build with
VC++ 6.0 can lead to trouble.

python24_d.lib is the debug version of the python library.
It's possible to build your application in debug against a
release Python Version. But I don't know what switches are needed.

This unresolved external symbols are a result of your linkage.
This symbols are only present in the debug version of the library.
If you start python_d.exe (debug executable of python) you get
the total ref count after every statement.

To fix this, build debug version of your App against debug version
of python or set all switches to build a debug version against release
python.
The boost python library does this, see:
http://www.boost.org/libs/python/doc/index.html


bye by Wolfgang



More information about the Python-list mailing list