473,387 Members | 1,530 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

Swig errors and warnings

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
1 2589
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Matt Whelan | last post by:
Supposedly, recent versions of SWIG can be made to work with MS VC++'s non-standard integer data types. According to a recent SWIG ChangeLog entry: %apply long long { __int64 }; should make...
0
by: Andrew Collier | last post by:
hello, i am not sure whether this problem relates to swig, python or my c++ compiler. +please forgive me if this is inappropriately posted but i am sure that someone +on this list must have some...
0
by: Helmut Zeisel | last post by:
I want to build a static extension of Python using SWIG and VC++ 6.0 as described in http://www.swig.org/Doc1.3/Python.html#n8 for gcc. My file is testerl.i: ========================= %module...
2
by: superprad | last post by:
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 Steps I followed : $swig...
0
by: ReaprZero | last post by:
Hi, I'm using Cygwin and ActiveState perl to try to compile a sample application using SWIG. I'm using the short tutorial from http://www.swig.org/tutorial.html (the perl part of it), but with a...
2
by: ajikoe | last post by:
Hi, I tried to follow the example in swig homepage. I found error which I don't understand. I use bcc32, I already include directory where my python.h exist in bcc32.cfg. /* File : example.c...
0
by: stumblecrab | last post by:
Hello, I've looked at the swig example in the back of "programming python" (Lutz). Using gcc to compile a swig wrapper I'm getting lots of errors. Instead of using the cygwin python, I'm...
3
by: Soren | last post by:
Hi, I went through the SWIG tutorial for the example named "simple". I managed to get to the first step, creating example_wrap.c using swig, and doing: "gcc -fpic -c example_wrap.c...
3
by: code_berzerker | last post by:
Hi i'm relatively new to Python and my C/C++ knowledge is near to None. Having said that I feel justified to ask stupid questions :) Ok now more seriously. I have question refering to char* used...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.