473,695 Members | 3,309 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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+0x 18): In
function `_start':
.../sysdeps/i386/elf/start.S:98: undefined reference to `main'
/tmp/ccayOWVb.o(.tex t+0xb6f): In function `PySwigObject_r epr':
: undefined reference to `PyString_FromF ormat'
/tmp/ccayOWVb.o(.tex t+0xbe1): In function `PySwigObject_s tr':
: undefined reference to `PyString_FromS tring'
/tmp/ccayOWVb.o(.tex t+0xc22): In function `PySwigObject_l ong':
: undefined reference to `PyLong_FromUns ignedLong'
/tmp/ccayOWVb.o(.tex t+0xc87): In function `PySwigObject_o ct':
: undefined reference to `PyOS_snprintf'
and a bunch of them........... ...

: undefined reference to `PyModule_GetDi ct'
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 2608
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+0x 18): 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(.tex t+0xb6f): In function `PySwigObject_r epr':
: undefined reference to `PyString_FromF ormat'
/tmp/ccayOWVb.o(.tex t+0xbe1): In function `PySwigObject_s tr':
: undefined reference to `PyString_FromS tring'
/tmp/ccayOWVb.o(.tex t+0xc22): In function `PySwigObject_l ong':
: undefined reference to `PyLong_FromUns ignedLong'
/tmp/ccayOWVb.o(.tex t+0xc87): In function `PySwigObject_o ct':
: undefined reference to `PyOS_snprintf'
and a bunch of them........... ... : undefined reference to `PyModule_GetDi ct'
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***********@p hysik.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
4774
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 Swig happy. But it doesn't. I get Syntax Errors on each line where __int64 appears. Am I missing something? I'm new to SWIG (but not to Python or C++).
0
1632
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 good ideas. i have also sent i to the swig users list a couple of times but have not got any response so i am casting my net a little wider... i have been struggling with the following problem for a couple of days now. +specifically, i have a...
0
2498
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 testerl extern int hz(int i);
2
1905
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 -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/
0
2404
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 simplified version of their example (just a void hello() {printf("Hello, world!\n");} and corresponding .i interface file, %module hello \ extern void hello();). I first do swig -perl5 hello.i which works fine.
2
4448
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 */ #include <time.h>
0
1130
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 trying to point swig to my activepython installation. I'm doing this because my modules are all win32 installed, and not cygwin installed. Can anyone help me? I'm pointing to C:/python24/include and C:/python24/Libs.
3
3682
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 -IC:\python24\include " to create example_wrap.o But when I needed to compile the library file using:
3
2118
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 as function parameters to return values. I have read SWIG manual to find best way to overcome that, but there are many warnings about memory leaks and stuff, so I feel confused. Ok to put it more simply: how to safely define a variable in...
0
8640
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9122
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9001
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
8832
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7672
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6498
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4587
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3018
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
2281
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.