Problems building C++ extension

Brian Victor wrote:

I'm finally trying to update the extension I wrote during the 2.4 days
to 2.5. I'm using wxPython 2.5.3.1 and downloaded and compiled swig
1.3.22 with the patch in wxPython/SWIG.

Steps I'm taking:
  1) swig -c++ -python -I/home/bhv1/src/wxPython-src-2.5.3.1/wxPython/src
     -I/home/bhv1/src/SWIG-1.3.22/Lib/python bwaascale.i
     Runs without errors.

  2) setup.py build # for my extension. runs gcc as:
      gcc -pthread -fno-strict-aliasing -DNDEBUG -g -O3 -Wall
      -Wstrict-prototypes -fPIC -Isrc -I/usr/include/python2.3 -c
      src/bwaascale_wrap.cxx -o build/temp.linux-ppc-2.3/src/bwaascale_wrap.o
      -I/home/bhv1/local/lib/wx/include/gtk2-unicode-debug-2.5
      -I/home/bhv1/local/include/wx-2.5 -D__WXDEBUG__ -D__WXGTK__
      -D_FILE_OFFSET_BITS=64 -D_LARGE_FILES
      -I/home/bhv1/src/wxPython-src-2.5.3.1/wxPython/include

It chokes on this line in the generated cxx file:
  bool wxPyCheckSwigType(const wxChar* className) {

because wxPython.h from 2.5.3.1 has this macro:
  #define wxPyCheckSwigType(a) (wxPyGetCoreAPIPtr()->p_wxPyCheckSwigType(a))

Removing wxPython.h from my .i file produces different undefined
symbols. The only changes I made to my .i file for 2.5 were removing
the extern lines in favor of importing _core_api and __core_rename.

Any ideas how to get this working? Thanks!

You should just "%import core.i" (or perhaps windows.i if you need type declarations of some of the classes there.) Otherwise your generated code will duplicate things that it should just be using from the core module. Take a look at one of the .i files from the contribs directory and use that as a template.

···

--
Robin Dunn
Software Craftsman
http://wxPython.org Java give you jitters? Relax with wxPython!