473,378 Members | 1,498 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,378 software developers and data experts.

SWIG & C Extensions, win32 & MinGW: undefined reference


Going through the tutorial on http://swig.org, I created the example files
(pasted below). After generating the _wrap file, I tried compiling (using
mingw32) and received a lot of undefined reference compiler errors:

...\build\temp.win32-2.5\Release\example_wrap.o:example_wrap.c:(.text+0 x670f):
undefined reference to `_imp__PyExc_MemoryError'

there are many other similar errors all prefaced with _imp__Py, so I am
assuming there is a linker error with the python libraries. I have adjusted
my PATH variable to include all the python directories (libs/dlls), so I am
unclear what else I can try. Any suggestions?
FILES FROM TUTORIAL:
//example.c
#include <time.h>
double My_variable = 3.0;

int fact(int n) {
if (n <= 1) return 1;
else return n*fact(n-1);
}

int my_mod(int x, int y) {
return (x%y);
}

char *get_time()
{
time_t ltime;
time(&ltime);
return ctime(&ltime);
}
//************************************************** *************

//example.i
%module example
%{
/* Put header files here or function declarations like below */
extern double My_variable;
extern int fact(int n);
extern int my_mod(int x, int y);
extern char *get_time();
%}

extern double My_variable;
extern int fact(int n);
extern int my_mod(int x, int y);
extern char *get_time();
//************************************************** *************

//setup.py
from distutils.core import setup, Extension

setup(name='example',
version = '1.0',
ext_modules=[
Extension('example', ['example.c', 'example.i'])
])

//************************************************** *************
--
View this message in context: http://www.nabble.com/SWIG---C-Exten...p14373972.html
Sent from the Python - python-list mailing list archive at Nabble.com.

Dec 17 '07 #1
0 1568

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Phil Schmidt | last post by:
I'm attempting to follow the instructions at http://sebsauvage.net/python/mingw.html, without luck. I have Python 2.3, MinGW 3.2.3, ans SWIG 1.3.19. I get an export error on "initexample" when...
0
by: A. B., Khalid | last post by:
Hello all. After the effort of getting most of Python 2.3.4 Final compiled in MinGW (see: http://mail.python.org/pipermail/python-list/2004-June/225967.html, and get the patch and read more...
3
by: Kevin Dahlhausen | last post by:
Could anyone post a simple setup.py script that uses a SWIG interface to C++ code and the mingw compiler? I followed some online samples, and am using the setup.cfg file to specify swig-c++=1....
4
by: A. B., Khalid | last post by:
Hello all. This is to inform those interested in getting Python to compile in MinGW that the pyMinGW patch is now able to help compile both Python 2.3.4 Final and Python 2.4a3 and the resulting...
0
by: Jerry He | last post by:
Hi, I just installed SWIG on Windows(Cygwin) and tried to use it to compile some of the example python programs. For the first two commands it produced no error swig -python example.i gcc -c...
1
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 $swig -python test_hk.c this...
0
by: Michael Yanowitz | last post by:
Hello: I am just trying out SWIG, but quickly ran into problems. Using Cygwin gcc, I tried the following: 1) Created example.c (as given on http://www.swig.org/tutorial.html ) /* File :...
0
by: mani | last post by:
Hi I'm bringing up an old story once more! I'm on win32 (winxp sp2) python 2.4.4. mingw gcc version is 3.4.5. msys is in c:\msys. mingw is in c:\mingw and python is in c:\pyton24. there is also...
2
by: eliben | last post by:
On Jun 27, 3:10 pm, eliben <eli...@gmail.comwrote: Problem solved: http://eli.thegreenplace.net/2008/06/28/compiling-python-extensions-with-distutils-and-mingw/
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
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: 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
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
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...

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.