By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
429,365 Members | 3,095 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 429,365 IT Pros & Developers. It's quick & easy.

Swig errors and warnings

P: n/a
Hi I am trying to write a python wrapper for a C code I have using
swig. when i try to compile the wrap.c i get a bunch of these warnings
and errors can anyone help

$swig -python test_hk.c
this generates test_hk.py and test_hk_wrap.c
then i compile it as

$gcc -Wall -std=c99 test_hk.c test_hk_wrap.c -I/usr/include/python2.3/

/usr/lib/gcc-lib/i486-linux/3.3.5/../../../crt1.o(.text+0x18): In
function `_start':
.../sysdeps/i386/elf/start.S:98: undefined reference to `main'
/tmp/ccayOWVb.o(.text+0xb6f): In function `PySwigObject_repr':
: undefined reference to `PyString_FromFormat'
/tmp/ccayOWVb.o(.text+0xbe1): In function `PySwigObject_str':
: undefined reference to `PyString_FromString'
/tmp/ccayOWVb.o(.text+0xc22): In function `PySwigObject_long':
: undefined reference to `PyLong_FromUnsignedLong'
/tmp/ccayOWVb.o(.text+0xc87): In function `PySwigObject_oct':
: undefined reference to `PyOS_snprintf'
and a bunch of them..............

: undefined reference to `PyModule_GetDict'
collect2: ld returned 1 exit status

do I have to include any libraries or whats it that I am missing.

Nov 14 '05 #1
Share this Question
Share on Google+
1 Reply


P: n/a
su*******@gmail.com wrote:
Hi I am trying to write a python wrapper for a C code I have using
swig. when i try to compile the wrap.c i get a bunch of these warnings
and errors can anyone help
You get some linker warnings, which (nearly?) always indicates
that this isn't a C problem. So it's basically off-topic here.
$swig -python test_hk.c
this generates test_hk.py and test_hk_wrap.c
then i compile it as $gcc -Wall -std=c99 test_hk.c test_hk_wrap.c -I/usr/include/python2.3/ /usr/lib/gcc-lib/i486-linux/3.3.5/../../../crt1.o(.text+0x18): In
function `_start':
../sysdeps/i386/elf/start.S:98: undefined reference to `main'
Looks like you don't have a main() function. Chances are that you
want to create a shared library or DLL or whatever which doesn't
have a main() function since it's not a real programm.
/tmp/ccayOWVb.o(.text+0xb6f): In function `PySwigObject_repr':
: undefined reference to `PyString_FromFormat'
/tmp/ccayOWVb.o(.text+0xbe1): In function `PySwigObject_str':
: undefined reference to `PyString_FromString'
/tmp/ccayOWVb.o(.text+0xc22): In function `PySwigObject_long':
: undefined reference to `PyLong_FromUnsignedLong'
/tmp/ccayOWVb.o(.text+0xc87): In function `PySwigObject_oct':
: undefined reference to `PyOS_snprintf'
and a bunch of them.............. : undefined reference to `PyModule_GetDict'
collect2: ld returned 1 exit status


Lots of errors that indicate that you are probably missing some
library or even libraries, most likely related to Python and Swig.

Your chances for a well-informed answer are going to be much higher
in a newsgroup dedicated to these kinds of problems, in your case
probably some group about developing extensions for Python.

Regards, Jens
--
\ Jens Thoms Toerring ___ Je***********@physik.fu-berlin.de
\__________________________ http://www.toerring.de
Nov 14 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.