Hi Everyone, Recently I have been working on building a module for Python from C++ code, with SWIG, and towards the end of compiling the various sets of code I'm getting an error.
[comp:~/swig_project] user% swig -c++ -python example.i [comp:~/swig_project] user% g++ -c example.cpp [comp:~/swig_project] user% g++ -c example_wrap.cxx -I/scisoft/i386/ Packages/Python-2.4.3/Python.framework/Versions/2.4/include/python2.4/ example_wrap.cxx: In function 'PyObject* _wrap_main(PyObject*, PyObject*)': example_wrap.cxx:735: error: 'main' was not declared in this scope The beginning of example.i looks like the following: %module filename %{ #define file_plugin "plugins/file.h" #if foo_OS!=2 #include <pthread.h> #endif #include "../Foo.h" using namespace foo_library; %} The error that is being picked up in reference to 'main' is contained in the following excerpt, generated by SWIG (example_wrap.cxx): /*----------------------------------------------- @(target):= _filename.so ------------------------------------------------*/ #define SWIG_init init_filename #define SWIG_name "_filename" #define cimg_plugin "plugins/file.h" #if foo_OS!=2 #include <pthread.h> #endif #include "../Foo.h" using namespace foo_library; #ifdef __cplusplus extern "C" { #endif static PyObject *_wrap_main(PyObject *self, PyObject *args) { PyObject *resultobj; int arg1 ; char **arg2 = (char **) 0 ; int result; PyObject * obj1 = 0 ; if(!PyArg_ParseTuple(args,(char *)"iO:main",&arg1,&obj1)) goto fail; if ((SWIG_ConvertPtr(obj1,(void **) &arg2, SWIGTYPE_p_p_char,SWIG_POINTER_EXCEPTION | 0 )) == -1) SWIG_fail; result = (int)main(arg1,arg2); resultobj = PyInt_FromLong((long)result); return resultobj; fail: return NULL; } Any clues as to what is happening here or what to do next? If you know, your help would greatly help. Thanks in advance! -- http://mail.python.org/mailman/listinfo/python-list