Need Help Building PythonQt on Windows

Diez B. Roggisch deets at nospam.web.de
Sun Mar 9 13:36:18 EDT 2008


Jeff Schiller schrieb:
> Hello,
> 
> I'm creating an application using Qt (4.4 Beta atm).  I have pretty
> close to zero experience with Python (consisting of installing the
> Python interpreter, downloading a python programming and executing it
> on the command-line).
> 
> I would like to invoke a Python script from my C++ Qt program and
> capture its output as a C++ structure.  It seems that PythonQt might
> be suitable for my needs.
> 
> Being a Qt program, I want this thing to be cross-platform.  I'm
> having trouble getting things set up in Windows.  Has anyone had any
> experience with this?
> 
> I've built Qt from source using the mingw32 compiler.  I installed
> Python 2.5 binary.  I am trying to build PythonQt from source.  As per
> http://pythonqt.sourceforge.net/#Building it says I need a "developer
> installation" of Python containing the header files and  the library
> files.  When I look at my system after installing the Python 2.5
> binary, I can see I have header files (C:\Python25\include), a 199k
> python25.lib (C:\Python25\libs) and a 2MB python25.dll
> (C:\Windows\System32\).  Have I got what I need?
> 
> I have tried to set up my symbols (PYTHON_PATH, PYTHON_LIB,
> PYTHONQT_ROOT).  I generate the Makefile (using qmake) and it starts
> to build but then it fails:
> 
> g++ -enable-stdcall-fixup -Wl,-enable-auto-import
> -Wl,-enable-runtime-pseudo-reloc -mthreads -Wl -shared
> -Wl,--out-implib,lib\libPythonQt.a -o lib\PythonQt.dll
> object_script.PythonQt.Debug  -L"c:\Qt\4.4.0-beta1\lib"
> "c:\Python25\libs"/python25.lib -lQtGuid4 -lQtCored4
> ./debug\PythonQt.o: In function `ZN8PythonQtC2Ei':
> C:/PythonQt-1.0/src/PythonQt.cpp:118: undefined reference to
> `_imp__Py_NoSiteFlag'
> ./debug\PythonQt.o: In function `ZN8PythonQtC1Ei':
> C:/PythonQt-1.0/src/PythonQt.cpp:118: undefined reference to
> `_imp__Py_NoSiteFlag'
> ./debug\PythonQt.o: In function `ZN15PythonQtPrivate11wrapQObjectEP7QObject':
> C:/PythonQt-1.0/src/PythonQt.cpp:256: undefined reference to
> `_imp___Py_NoneStruct'
> C:/PythonQt-1.0/src/PythonQt.cpp:257: undefined reference to
> `_imp___Py_NoneStruct'
> ./debug\PythonQt.o: In function `ZN15PythonQtPrivate7wrapPtrEPvRK10QByteArray':
> C:/PythonQt-1.0/src/PythonQt.cpp:281: undefined reference to
> `_imp___Py_NoneStruct'
> C:/PythonQt-1.0/src/PythonQt.cpp:282: undefined reference to
> `_imp___Py_NoneStruct'
> ./debug\PythonQt.o: In function
> `ZN8PythonQt13introspectionEP7_objectRK7QStringNS_10ObjectTypeE':
> C:/PythonQt-1.0/src/PythonQt.cpp:620: undefined reference to
> `_imp__PyClass_Type'
> C:/PythonQt-1.0/src/PythonQt.cpp:625: undefined reference to
> `_imp__PyClass_Type'
> C:/PythonQt-1.0/src/PythonQt.cpp:625: undefined reference to
> `_imp__PyCFunction_Type'
> ...
> 
> Since I'm new to compiling Qt with mingw and completely new to python,
> I was hoping for tips on why I'm getting these errors.  If anyone has
> a better suggestion for a forum/mailing list then please let me know.


A few of suggestions:

  - take this to the PyQt mailing list 
(http://www.riverbankcomputing.com/mailman/listinfo/pyqt)

  - you only *need* pyqt if what you want to do in python has really to 
deal with Qt-objects - maybe "simple" embedding is enough for your needs

  - I don't see why you need to compile PyQt yourself at all - are you 
sure you can't use the stock PyQt for windows? What makes you believe 
you really need this to be self-compiled?

Diez



More information about the Python-list mailing list