LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Software (https://www.linuxquestions.org/questions/linux-software-2/)
-   -   swig 13.3.39, ubuntu 8.10, problem with importing C program to python (https://www.linuxquestions.org/questions/linux-software-2/swig-13-3-39-ubuntu-8-10-problem-with-importing-c-program-to-python-746318/)

plugo 08-09-2009 10:29 PM

swig 13.3.39, ubuntu 8.10, problem with importing C program to python
 
Hey guys, i have downloaded swig 13.3.39 for linux and have python on my machine. i have read a lot of tutorials and cannot get to use my link.c program into the python interpreter. here are my steps and outputs:

pedro@pedro-laptop:~/Desktop$ gcc -c -fpic link_wrap.c link.c -I/usr/include/python2.5 -I/usr/lib/python2.5/config
link_wrap.c:125:20: error: Python.h: No such file or directory
link_wrap.c:756: error: expected ‘)’ before ‘*’ token
link_wrap.c:780: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token
link_wrap.c:806: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token
link_wrap.c:860: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token
link_wrap.c:881: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token
link_wrap.c: In function ‘SWIG_Python_AddErrorMsg’:
link_wrap.c:928: error: ‘PyObject’ undeclared (first use in this function)
link_wrap.c:928: error: (Each undeclared identifier is reported only once
link_wrap.c:928: error: for each function it appears in.)
link_wrap.c:928: error: ‘type’ undeclared (first use in this function)
link_wrap.c:929: error: ‘value’ undeclared (first use in this function)
link_wrap.c:930: error: ‘traceback’ undeclared (first use in this function)
link_wrap.c:935: error: ‘old_str’ undeclared (first use in this function)
link_wrap.c:939: warning: assignment makes pointer from integer without a cast
link_wrap.c:944: error: ‘PyExc_RuntimeError’ undeclared (first use in this function)
link_wrap.c: At top level:
link_wrap.c:1049: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token
link_wrap.c:1124: error: expected ‘)’ before ‘*’ token
link_wrap.c:1132: error: expected ‘)’ before ‘*’ token
link_wrap.c:1143: error: expected ‘)’ before ‘*’ token
link_wrap.c:1150: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token
link_wrap.c:1196: error: expected ‘)’ before ‘*’ token
link_wrap.c:1298: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token
link_wrap.c:1309: error: expected specifier-qualifier-list before ‘PyObject’
link_wrap.c: In function ‘SWIG_Python_CheckImplicit’:
link_wrap.c:1321: error: ‘SwigPyClientData’ has no member named ‘implicitconv’
link_wrap.c: At top level:
link_wrap.c:1324: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token
link_wrap.c:1333: error: expected ‘)’ before ‘*’ token
link_wrap.c: In function ‘SwigPyClientData_Del’:
link_wrap.c:1388: error: ‘SwigPyClientData’ has no member named ‘newraw’
link_wrap.c:1389: error: ‘SwigPyClientData’ has no member named ‘newargs’
link_wrap.c:1390: error: ‘SwigPyClientData’ has no member named ‘destroy’
link_wrap.c: At top level:
link_wrap.c:1396: error: expected specifier-qualifier-list before ‘PyObject_HEAD’
link_wrap.c:1403: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token
link_wrap.c:1409: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token
link_wrap.c:1431: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token
link_wrap.c:1437: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token
link_wrap.c:1443: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token
link_wrap.c:1473: error: expected declaration specifiers or ‘...’ before ‘FILE’
link_wrap.c: In function ‘SwigPyObject_print’:
link_wrap.c:1479: error: ‘PyObject’ undeclared (first use in this function)
link_wrap.c:1479: error: ‘repr’ undeclared (first use in this function)
link_wrap.c:1482: warning: assignment makes pointer from integer without a cast
link_wrap.c:1483: error: ‘fp’ undeclared (first use in this function)
link_wrap.c: At top level:
link_wrap.c:1492: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token
link_wrap.c: In function ‘SwigPyObject_compare’:
link_wrap.c:1503: error: ‘SwigPyObject’ has no member named ‘ptr’
link_wrap.c:1504: error: ‘SwigPyObject’ has no member named ‘ptr’
link_wrap.c: At top level:
link_wrap.c:1509: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token
link_wrap.c:1526: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token
link_wrap.c:1528: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token
link_wrap.c:1535: error: expected ‘)’ before ‘*’ token
link_wrap.c:1540: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token
link_wrap.c:1544: error: expected ‘)’ before ‘*’ token
link_wrap.c:1578: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token
link_wrap.c:1595: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token
link_wrap.c:1611: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token
link_wrap.c:1623: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token
link_wrap.c:1635: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token
link_wrap.c:1683: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘swigobject_methods’
link_wrap.c:1695: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token
link_wrap.c:1702: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token
link_wrap.c:1835: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token
link_wrap.c:1853: error: expected specifier-qualifier-list before ‘PyObject_HEAD’
link_wrap.c:1860: error: expected declaration specifiers or ‘...’ before ‘FILE’
link_wrap.c: In function ‘SwigPyPacked_print’:
link_wrap.c:1863: error: ‘fp’ undeclared (first use in this function)
link_wrap.c:1864: error: ‘SwigPyPacked’ has no member named ‘pack’
link_wrap.c:1864: error: ‘SwigPyPacked’ has no member named ‘size’
link_wrap.c:1868: error: ‘SwigPyPacked’ has no member named ‘ty’
link_wrap.c: At top level:
link_wrap.c:1873: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token
link_wrap.c:1884: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token
link_wrap.c: In function ‘SwigPyPacked_compare’:
link_wrap.c:1898: error: ‘SwigPyPacked’ has no member named ‘size’
link_wrap.c:1899: error: ‘SwigPyPacked’ has no member named ‘size’
link_wrap.c:1901: error: ‘SwigPyPacked’ has no member named ‘pack’
link_wrap.c:1901: error: ‘SwigPyPacked’ has no member named ‘pack’
link_wrap.c:1901: error: ‘SwigPyPacked’ has no member named ‘size’
link_wrap.c: At top level:
link_wrap.c:1904: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token
link_wrap.c:1906: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token
link_wrap.c:1913: error: expected ‘)’ before ‘*’ token
link_wrap.c:1919: error: expected ‘)’ before ‘*’ token
link_wrap.c:1928: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token
link_wrap.c:2010: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token
link_wrap.c:2030: error: expected ‘)’ before ‘*’ token
link_wrap.c:2046: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token
link_wrap.c:2052: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token
link_wrap.c:2067: error: expected ‘)’ before ‘*’ token
link_wrap.c:2118: error: expected ‘)’ before ‘*’ token
link_wrap.c:2133: error: expected ‘)’ before ‘*’ token
link_wrap.c:2224: error: expected ‘)’ before ‘*’ token
link_wrap.c:2256: error: expected ‘)’ before ‘*’ token
link_wrap.c:2278: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token
link_wrap.c:2348: error: expected ‘)’ before ‘*’ token
link_wrap.c:2369: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token
link_wrap.c:2387: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token
link_wrap.c:2408: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token
link_wrap.c: In function ‘SWIG_Python_GetModule’:
link_wrap.c:2430: warning: assignment makes pointer from integer without a cast
link_wrap.c: At top level:
link_wrap.c:2444: error: expected ‘)’ before ‘*’ token
link_wrap.c: In function ‘SWIG_Python_SetModule’:
link_wrap.c:2490: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘swig_empty_runtime_method_table’
link_wrap.c:2490: error: ‘swig_empty_runtime_method_table’ undeclared (first use in this function)
link_wrap.c:2490: error: expected expression before ‘]’ token
link_wrap.c:2496: error: ‘PyObject’ undeclared (first use in this function)
link_wrap.c:2496: error: ‘module’ undeclared (first use in this function)
link_wrap.c:2499: error: ‘pointer’ undeclared (first use in this function)
link_wrap.c: At top level:
link_wrap.c:2508: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token
link_wrap.c: In function ‘SWIG_Python_TypeQuery’:
link_wrap.c:2517: error: ‘PyObject’ undeclared (first use in this function)
link_wrap.c:2517: error: ‘cache’ undeclared (first use in this function)
link_wrap.c:2518: error: ‘key’ undeclared (first use in this function)
link_wrap.c:2519: error: ‘obj’ undeclared (first use in this function)
link_wrap.c: In function ‘SWIG_Python_AddErrMesg’:
link_wrap.c:2547: error: ‘PyObject’ undeclared (first use in this function)
link_wrap.c:2547: error: ‘type’ undeclared (first use in this function)
link_wrap.c:2548: error: ‘value’ undeclared (first use in this function)
link_wrap.c:2549: error: ‘traceback’ undeclared (first use in this function)
link_wrap.c:2553: error: ‘old_str’ undeclared (first use in this function)
link_wrap.c:2557: warning: assignment makes pointer from integer without a cast
link_wrap.c:2559: warning: assignment makes pointer from integer without a cast
link_wrap.c: In function ‘SWIG_Python_ArgFail’:
link_wrap.c:2576: warning: incompatible implicit declaration of built-in function ‘snprintf’
link_wrap.c: At top level:
link_wrap.c:2584: error: expected ‘)’ before ‘*’ token
link_wrap.c:2592: error: expected declaration specifiers or ‘...’ before ‘PyObject’
link_wrap.c: In function ‘SWIG_Python_TypeError’:
link_wrap.c:2606: error: ‘obj’ undeclared (first use in this function)
link_wrap.c:2608: error: ‘PyObject’ undeclared (first use in this function)
link_wrap.c:2608: error: ‘str’ undeclared (first use in this function)
link_wrap.c:2611: error: ‘PyExc_TypeError’ undeclared (first use in this function)
link_wrap.c: At top level:
link_wrap.c:2631: error: expected ‘)’ before ‘*’ token
link_wrap.c:2673:4: error: #error "This python version requires swig to be run with the '-classic' option"
link_wrap.c:2718: error: expected ‘)’ before ‘*’ token
link_wrap.c:2796: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token
link_wrap.c:2817: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token
link_wrap.c:2835: error: expected ‘)’ before ‘*’ token
link_wrap.c: In function ‘SWIG_CanCastAsInteger’:
link_wrap.c:2891: error: ‘errno’ undeclared (first use in this function)
link_wrap.c:2891: error: ‘EDOM’ undeclared (first use in this function)
link_wrap.c:2891: error: ‘ERANGE’ undeclared (first use in this function)
link_wrap.c: At top level:
link_wrap.c:2915: error: expected ‘)’ before ‘*’ token
link_wrap.c:2954: error: expected ‘)’ before ‘*’ token
link_wrap.c:2972: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token
link_wrap.c:2981: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token
link_wrap.c:3006: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token
link_wrap.c:3027: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token
link_wrap.c:3048: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token
link_wrap.c:3070: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘SwigMethods’
link_wrap.c:3357: error: expected specifier-qualifier-list before ‘PyObject’
link_wrap.c:3363: error: expected specifier-qualifier-list before ‘PyObject_HEAD’
link_wrap.c:3367: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token
link_wrap.c:3376: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token
link_wrap.c:3415: error: expected declaration specifiers or ‘...’ before ‘FILE’
link_wrap.c: In function ‘swig_varlink_print’:
link_wrap.c:3417: error: ‘PyObject’ undeclared (first use in this function)
link_wrap.c:3417: error: ‘str’ undeclared (first use in this function)
link_wrap.c:3418: warning: incompatible implicit declaration of built-in function ‘fprintf’
link_wrap.c:3418: error: ‘fp’ undeclared (first use in this function)
link_wrap.c:3419: warning: assignment makes pointer from integer without a cast
link_wrap.c: In function ‘swig_varlink_dealloc’:
link_wrap.c:3427: error: ‘swig_varlinkobject’ has no member named ‘vars’
link_wrap.c:3429: error: ‘swig_globalvar’ has no member named ‘next’
link_wrap.c: At top level:
link_wrap.c:3436: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token
link_wrap.c:3454: error: expected declaration specifiers or ‘...’ before ‘PyObject’
link_wrap.c: In function ‘swig_varlink_setattr’:
link_wrap.c:3456: error: ‘swig_varlinkobject’ has no member named ‘vars’
link_wrap.c:3459: error: ‘swig_globalvar’ has no member named ‘set_attr’
link_wrap.c:3459: error: ‘p’ undeclared (first use in this function)
link_wrap.c:3462: error: ‘swig_globalvar’ has no member named ‘next’
link_wrap.c:3465: error: ‘PyExc_NameError’ undeclared (first use in this function)
link_wrap.c: At top level:
link_wrap.c:3470: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token
link_wrap.c:3530: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token
link_wrap.c:3540: error: expected ‘)’ before ‘*’ token
link_wrap.c:3556: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token
link_wrap.c:3569: error: expected ‘)’ before ‘*’ token
link_wrap.c:3596: error: expected ‘)’ before ‘*’ token
link_wrap.c: In function ‘init_link’:
link_wrap.c:3656: error: ‘PyObject’ undeclared (first use in this function)
link_wrap.c:3656: error: ‘m’ undeclared (first use in this function)
link_wrap.c:3656: error: ‘d’ undeclared (first use in this function)
link_wrap.c:3672: error: ‘SwigMethods’ undeclared (first use in this function)
pedro@pedro-laptop:~/Desktop$

i know its a lil bit long, but i would really like to see what is going on, here is also my link.i:
Code:

/* link.i */

%module link
%{
/* Put header files */
extern char *procread(const char *entry);
extern void gettxrx(int fd);
extern void getpckts(int fd);
extern int wait ( int seconds );
%}

extern char *procread(const char *entry);
extern void gettxrx(int fd);
extern void getpckets(int fd);
extern int wait ( int seconds );

ANY help would be greatly appreciated, Thanks.

GrapefruiTgirl 08-09-2009 10:39 PM

Hi,

not sure exactly *why* you posted this twice.. Maybe by mistake? Anyhow, THIS one will be closed shortly, and let's please continue the discussion HERE.

Thanks,
Sasha


All times are GMT -5. The time now is 08:29 AM.