swig-problem

merman merman at freenet.de
Mon Apr 8 10:58:28 EDT 2002


Hello pythonistas,

sorry for my strange english!

I'm a newbie and I have a problem with SWIG-1.3.11.
I use win2k with the Borland-Compiler bcc55 (commandline).

I want try to write a little python-extension in c++.

Here's is my Makefile:

--- Begin of
Makefile.tree-swig ---------------------------------------------------------
-------------------

SWIG        = swig
PY             = C:\Python22
PY_INC    = C:\Python22\include
CC            = bcc32
TARGET   = -eTreec.dll

#OPTIMIZE     = -O
#FORCE_CPP = -P

#..............................................................

#all: Treec.lib Tree.py
all: Treec.dll Tree.py

# wrapper + real class
Treec.dll: Tree_wrap.obj Tree.obj
 $(CC) $(TARGET) Tree_wrap.obj Tree.obj

#generated class wrapper module
Tree_wrap.obj: Tree_wrap.cxx Tree.h
 $(CC) -I$(PY_INC) -I$(PY) -c Tree_wrap.cxx

Tree_wrap.cxx: Tree.i
 $(SWIG) -c++ -python Tree.i

Tree.py: Tree.i
 $(SWIG) -c++ -python Tree.i

Tree.obj: Tree.cpp Tree.h
 $(CC) -c Tree.cpp

#.........................................................

cpptest:
 $(CC) -eGetDirs.exe TreeMain.cpp Tree.cpp

clean:
 del /P *.exe *.obj *.tds *.dll *.lib *.*~ *.cxx

--- end of
Makefile.tree-swig ---------------------------------------------------------
------------------

If I type 'make -f Makefile.tree-swig cpptest' the compiler works fine and
generates the 'GetDirs.exe'. So far so good!

But if I type this line: 'make -f Makefile.tree-swig' it appears the
following error-message:

Fatal F1003 c:\Borland\Bcc55\include\stdcomp.h 5: Error directive: Must use
C++
for STDCOMP.H
*** 1 errors in Compile ***

I think the problem is to say Swig it should generate the wrapper
'Tree_wrap.cpp' and not 'Tree_wrap.cxx' because bcc55-compiler don't know
the *.cxx-extension and therefore the failure above was generated?!?

How can I say SWIG it should generate wrappers mit *.cpp-extension and not
with the *.cxx-extension?

Anybody knows a solution?

It's lot of text - SORRY! But I could' t explain this better.

thanx Thomas









More information about the Python-list mailing list