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.cx x -I/scisoft/i386/
Packages/Python-2.4.3/Python.framewor k/Versions/2.4/include/python2.4/
example_wrap.cx x: In function 'PyObject* _wrap_main(PyOb ject*,
PyObject*)':
example_wrap.cx x: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.c xx):
/*-----------------------------------------------
@(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(PyO bject *self, PyObject *args) {
PyObject *resultobj;
int arg1 ;
char **arg2 = (char **) 0 ;
int result;
PyObject * obj1 = 0 ;
if(!PyArg_Parse Tuple(args,(cha r *)"iO:main",&ar g1,&obj1)) goto
fail;
if ((SWIG_ConvertP tr(obj1,(void **) &arg2,
SWIGTYPE_p_p_ch ar,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!
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.cx x -I/scisoft/i386/
Packages/Python-2.4.3/Python.framewor k/Versions/2.4/include/python2.4/
example_wrap.cx x: In function 'PyObject* _wrap_main(PyOb ject*,
PyObject*)':
example_wrap.cx x: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.c xx):
/*-----------------------------------------------
@(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(PyO bject *self, PyObject *args) {
PyObject *resultobj;
int arg1 ;
char **arg2 = (char **) 0 ;
int result;
PyObject * obj1 = 0 ;
if(!PyArg_Parse Tuple(args,(cha r *)"iO:main",&ar g1,&obj1)) goto
fail;
if ((SWIG_ConvertP tr(obj1,(void **) &arg2,
SWIGTYPE_p_p_ch ar,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!
Comment