LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Closed Thread
  Search this Thread
Old 08-09-2009, 09:29 PM   #1
plugo
LQ Newbie
 
Registered: Jun 2009
Posts: 20

Rep: Reputation: 0
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.
 
Old 08-09-2009, 09:39 PM   #2
GrapefruiTgirl
LQ Guru
 
Registered: Dec 2006
Location: underground
Distribution: Slackware64
Posts: 7,594

Rep: Reputation: 555Reputation: 555Reputation: 555Reputation: 555Reputation: 555Reputation: 555
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
 
  


Closed Thread


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
perl mapi/swig dynaloader problem unkie888 Linux - Software 1 01-16-2008 05:56 PM
Problem with python program--gtk.glade? David the H. Linux - Software 2 02-08-2007 08:18 AM
Problem importing python module...cant install anything!!! bpedman Linux - Software 0 02-07-2007 08:02 PM
Importing Mandrake Accounts into Ubuntu Cinematography Ubuntu 4 05-23-2005 07:29 PM
importing trouble....python...regarding Tkinter maseby Programming 0 11-03-2003 01:54 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 11:28 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration